<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/21272" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2023-05-29T12:04:00-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/21272</id>

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2023-05-29T12:04:00-04:00</updated>

		<published>2023-05-29T12:04:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111981#p111981</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111981#p111981"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111981#p111981"><![CDATA[
You're right, didn't seen my version on gitlab was false.<br>Source corrected.<br><br>Nota: you can do PR on it rather than let me editing to add your corrections <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon May 29, 2023 12:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2023-05-29T11:38:57-04:00</updated>

		<published>2023-05-29T11:38:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111980#p111980</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111980#p111980"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111980#p111980"><![CDATA[
I copied the <em class="text-italics">restoday</em> as it was and didn't pay much attention to it. Today Fire asked me to have a look at an error he was getting and noticed that the <em class="text-italics">time</em> function had 4 arguments, while it expects 5 space separated integers of the form of "minute hour day month year".<br><br>To fix this replace:<div class="codebox"><p>Code: </p><pre><code>proc restoday {mi ho dm mo} { </code></pre></div>with:<div class="codebox"><p>Code: </p><pre><code>proc restoday {minute hour day month year} {</code></pre></div>or use the <em class="text-italics">args</em> trick since any of the arguments isn't used in the function:<div class="codebox"><p>Code: </p><pre><code>proc restoday args {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon May 29, 2023 11:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2023-05-26T12:05:59-04:00</updated>

		<published>2023-05-26T12:05:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111974#p111974</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111974#p111974"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111974#p111974"><![CDATA[
All working as intended <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Fri May 26, 2023 12:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2023-05-23T09:37:39-04:00</updated>

		<published>2023-05-23T09:37:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111971#p111971</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111971#p111971"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111971#p111971"><![CDATA[
I've updated my source. And kept my formatmsg proc <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Tue May 23, 2023 9:37 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2023-05-22T18:16:48-04:00</updated>

		<published>2023-05-22T18:16:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111970#p111970</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111970#p111970"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111970#p111970"><![CDATA[
1. I used list rather than simplified writing because the script was also a kind of tutorial, but I usually use {}<br><br>2. True, but regsub (and regexp) is my friend. I've a friend, yeah ! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>3. Can't remind why I made a proc formatmsg, probably I started on a more complex script<br><br>3.1. I forget my usual set nick [string tolower $nick] <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>3.2. You added an unbind onload... Usefull to remove deleted replies key on rehash / source<br>3.3. you recreate the help string on the fly rather than use $::bartender::cmds variable... impact on performances ?<br><br>And you don't check if "guest" is on chan <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> Could be interresting (was my idea, but I'll do that tomorrow)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Mon May 22, 2023 6:16 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2023-05-22T13:43:50-04:00</updated>

		<published>2023-05-22T13:43:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111968#p111968</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111968#p111968"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111968#p111968"><![CDATA[
Saw your code and added the 'nick change' he asked, made a few changes here and there. To name a few.. <br><br>1. Replaced [list ... ] with { .. }. From the point of view of the compiler it makes no difference, but for user it's easier to see a difference between:<div class="codebox"><p>Code: </p><pre><code> set replies(cola) [list "Serves icecold cola (%utoday/%utotal/%ctotal)" \      "Serves cola that been laying in pile of [censored] ~45c (%utoday/%utotal/%ctotal)" \      "Serves cola been standing close to box of dryice ~1,3c (%utoday/%utotal/%ctotal)" \      "Serves cola that been standing next to comp for few hrs (%utoday/%utotal/%ctotal)"]</code></pre></div>and this:<div class="codebox"><p>Code: </p><pre><code>set replies(cola) {"Serves icecold cola (%utoday/%utotal/%ctotal)""Serves cola that been laying in pile of [censored] ~45c (%utoday/%utotal/%ctotal)""Serves cola been standing close to box of dryice ~1,3c (%utoday/%utotal/%ctotal)""Serves cola that been standing next to comp for few hrs (%utoday/%utotal/%ctotal)"}</code></pre></div>2. <em class="text-italics">string map</em> is your friend, 'regsub -all --' isn't. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>3. Removed <em class="text-italics">formatmsg</em> function, rebuilt the <em class="text-italics">help</em> one, and some other things I don't remember right now... oh.. and made the stats record stuff in lower case to make it work case in-sensitive.<br><br>Anyway, here's the updated code that he says is working as intended.<div class="codebox"><p>Code: </p><pre><code># Bartender v0.2b# By CrazyCat &lt;https://www.eggdrop.fr&gt;## type .chanset #channel +bar to activate on #channel# help command is !bar (public command on channel)namespace eval bartender {# List of replies# Variables:# - %nick : nick of the user# - %utoday, %utotal : user count for today and total# - %ctoday, %ctotal : channel count for today and total   set replies(coke) {"Are you stupid? We doesn't do [censored] like this... GO SLAP YOUR SELF IN THE NUTS! :P"}set replies(coffee) {"Making a cup of coffee for %nick, %utoday made today of %utotal ordered wich make it the %ctotal time i make coffee"}set replies(bang) {"fills a bang from stash and serves it to %nick (%utoday/%utotal/%ctotal)"}set replies(cola) {"Serves icecold cola (%utoday/%utotal/%ctotal)""Serves cola that been laying in pile of [censored] ~45c (%utoday/%utotal/%ctotal)""Serves cola been standing close to box of dryice ~1,3c (%utoday/%utotal/%ctotal)""Serves cola that been standing next to comp for few hrs (%utoday/%utotal/%ctotal)"}set replies(beer) {"Serves icecold beer (%utoday/%utotal/%ctotal)"}set replies(joint) {"Grabs a joint to %nick from the stash (%utoday/%utotal/%ctotal)"}# and so on.. you should get the idea.. I'm lazy.   # antiflood delay (in seconds)variable delay 10   ################################# DO NOT EDIT BELOW###############################variable wait variable author "CrazyCat"variable version "0.2b"setudef flag barsetudef str bardb   # Running commandproc process {nick uhost handle chan text} {if {![channel get $chan bar]} { return }set now [clock seconds]set cmd [string range $::lastbind 1 end]set chan [string tolower $chan]if {![info exists ::bartender::wait($chan)] || $::bartender::wait($chan)&lt;$now} {set ::bartender::wait($chan) [expr $now +3]} else {set since [expr $::bartender::wait($chan) - $now]set answer [lindex $::bartender::spam [rand [llength $::bartender::spam]]]puthelp "PRIVMSG $chan :[string map [list %since $since] $answer]"return}if {![info exists ::bartender::replies($cmd)]} {putserv "PRIVMSG $chan :The bar have [join $::bartender::cmds]"return}set lowerNick [string tolower $nick]statadd $chan $lowerNick $cmdset answer [lindex $::bartender::replies($cmd) [rand [llength $::bartender::replies($cmd)]]]set bar [channel get $chan bardb]set ctoday [dict get $bar today]set ctotal [dict get $bar total]set utoday [dict get $bar nicks $lowerNick today]set utotal [dict get $bar nicks $lowerNick total]if {[scan $text {%s} guest] &lt; 0} {set reply [string map [list %nick $lowerNick] $answer]} else {set reply [string map [list %nick $guest] $answer]}putserv "PRIVMSG $chan :[string map [list %chan $chan %ctoday $ctoday %ctotal $ctotal %utotal $utotal %utoday $utoday] $reply]"}# Add stats in bardb proc statadd {chan nick cmd} {if {[channel get $chan bardb] eq ""} {dict set bar total 1dict set bar today 1dict set bar nicks $nick today 1dict set bar nicks $nick total 1channel set $chan bardb $barreturn}set bar [channel get $chan bardb]dict incr bar totaldict incr bar todayif {![dict exists $bar nicks $nick]} {dict set bar nicks $nick today 1dict set bar nicks $nick total 1} else {set bn [dict get $bar nicks $nick]dict incr bn totaldict incr bn todaydict set bar nicks $nick $bn}channel set $chan bardb $barreturn}   # Creates associated bindsforeach ele [binds [namespace current]::*] {if {[scan $ele {%s%s%s%d%s} type flags cmd hits func] != 5} continueif {$type ne "pub"} continueunbind $type $flags $cmd $func}foreach trigger [array names ::bartender::replies] {bind pub - !$trigger ::bartender::processlappend ::bartender::cmds "!$trigger"}   # Small help: list all commandsbind pub - !bar ::bartender::helpproc help {nick uhost handle chan text} {if {![channel get $chan bar]} { return }foreach ele [array names ::bartender::replies] {lappend menu !$ele}putserv "PRIVMSG $chan :Today's menu: [join $menu ", "]"}   # Reset "Today" statsbind time - "00 00 * *" ::bartender::restodayproc restoday {mi ho dm mo} {foreach chan [channels] {if {![channel get $chan bar]} {channel set $chan bardb {}continue}set bar [channel get $chan bardb]if {$bar ne ""} {dict set bar today 0foreach nick [dict keys [dict get $bar nicks]] {dict set bar nicks $nick today 0}}channel set $chan bardb $bar}putlog "Bartender v${::bartender::version} by ${::bartender::author} loaded"}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon May 22, 2023 1:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2023-05-21T09:42:44-04:00</updated>

		<published>2023-05-21T09:42:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111967#p111967</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111967#p111967"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111967#p111967"><![CDATA[
Also asked (and answered) @ <a href="https://forum.eggdrop.fr/Bartender-script-%28PHP%29-t-2005.html" class="postlink">https://forum.eggdrop.fr/Bartender-scri ... -2005.html</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Sun May 21, 2023 9:42 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2023-05-13T09:03:50-04:00</updated>

		<published>2023-05-13T09:03:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111955#p111955</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111955#p111955"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111955#p111955"><![CDATA[
Thanks, but as I can see there is no total/sumtotal = have many drinks a user have had, in total today. and grand total all time <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Like: <div class="codebox"><p>Code: </p><pre><code>(Today: 1, Your Total: 406, Grand Total all users: 967)</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Sat May 13, 2023 9:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2023-05-13T08:50:35-04:00</updated>

		<published>2023-05-13T08:50:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111954#p111954</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111954#p111954"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111954#p111954"><![CDATA[
<a href="https://tclarchive.org/view.php?id=1584" class="postlink">https://tclarchive.org/view.php?id=1584</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sat May 13, 2023 8:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2023-05-13T08:29:13-04:00</updated>

		<published>2023-05-13T08:29:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111953#p111953</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111953#p111953"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111953#p111953"><![CDATA[
I have been there, and non of them do what I need<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Sat May 13, 2023 8:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-05-13T08:12:58-04:00</updated>

		<published>2023-05-13T08:12:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111952#p111952</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111952#p111952"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111952#p111952"><![CDATA[
you can find a lot of script for that on <br><br><a href="https://tclarchive.org/search.php?str=bartender&amp;cb1=t&amp;cb2=a&amp;cb3=d&amp;sub.x=0&amp;sub.y=0" class="postlink">https://tclarchive.org/search.php?str=b ... =0&amp;sub.y=0</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Sat May 13, 2023 8:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2023-05-13T02:23:58-04:00</updated>

		<published>2023-05-13T02:23:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111951#p111951</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111951#p111951"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111951#p111951"><![CDATA[
<blockquote class="uncited"><div>It helps if u provide a detailed description of what it does</div></blockquote>What the script does is servering things to users <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":-)" title="Smile"><br><div class="codebox"><p>Code: </p><pre><code> - docu:[nick] = nick that triggered, [today] how many heads/coffee person had today[total] = how many nick had it total, [last] time of last, [since] time since last[sumtotal], [sumchannel], [sumnetwork] = how many all had</code></pre></div>Triggers:<div class="codebox"><p>Code: </p><pre><code>$this-&gt;serve["triggers"]["bar"] = "This Bar have: !coffee !bang !cola !beer !joint !head !mix !whisky !pipe !pussy !coke !icecream";</code></pre></div>EX 1:<div class="codebox"><p>Code: </p><pre><code>!coffee</code></pre></div>Output:<div class="codebox"><p>Code: </p><pre><code> $this-&gt;serve["triggers"]["coffee"]  = "Making a cup of coffee for [nick], [today] made today of [total] ordered wich make it the [sumtotal] time i make coffee";</code></pre></div>And it stores it in a mysql database[/quote]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Sat May 13, 2023 2:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[simo]]></name></author>
		<updated>2023-05-12T18:00:22-04:00</updated>

		<published>2023-05-12T18:00:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111950#p111950</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111950#p111950"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111950#p111950"><![CDATA[
It helps if u provide a detailed description of what it does<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12505">simo</a> — Fri May 12, 2023 6:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2023-05-12T17:28:24-04:00</updated>

		<published>2023-05-12T17:28:24-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111949#p111949</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111949#p111949"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111949#p111949"><![CDATA[
No one what can help with it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Fri May 12, 2023 5:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Fire-Fox]]></name></author>
		<updated>2023-05-27T03:41:23-04:00</updated>

		<published>2023-04-29T12:02:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111892#p111892</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111892#p111892"/>
		<title type="html"><![CDATA[[SOLVED] Bartender script (PHP)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111892#p111892"><![CDATA[
Hi,<br><br>I have a fun project as I don't know much tcl and would love this to work with tcl <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><div class="codebox"><p>Code: </p><pre><code>&lt;?phpclass serve_mod extends module {public $title = "iRC SerVe";public $author = "g2x3k";public $version = "0.2";public function init() {// init// not working atm .. *TODO$this-&gt;serve["settings"]["antispam"] = "1/3"; //1 trigger each 3 sec ...$this-&gt;serve["settings"]["spamreplies"][] = "Hey hey there dont you think its going a bit to fast there only [since] since youre last ...";$this-&gt;serve["settings"]["spamreplies"][] = "iam busy ...";$this-&gt;serve["settings"]["spamreplies"][] = "havent you just had ?";$this-&gt;serve["settings"]["dateformat"] = "h:i:s";// config of avaible stuff for serving ...$this-&gt;serve["triggers"]["bar"] = "This Bar have: !coffee !bang !cola !beer !joint !head !mix !whisky !pipe !pussy !coke !icecream";$this-&gt;serve["triggers"]["coke"] = "Are you stupid? We doesn't do [censored] like this... GO SLAP YOUR SELF IN THE NUTS! :P";$this-&gt;serve["triggers"]["coffee"]  = "Making a cup of coffee for [nick], [today] made today of [total] ordered wich make it the [sumtotal] time i make coffee";$this-&gt;serve["triggers"]["bang"][] = "fills a bang from stash and serves it to [nick] ([today]/[total]/[sumtotal])";$this-&gt;serve["triggers"]["cola"][] = "Serves icecold cola ([today]/[total]/[sumtotal])";        $this-&gt;serve["triggers"]["cola"][] = "Serves cola that been laying in pile of [censored] ~45c ([today]/[total]/[sumtotal])";        $this-&gt;serve["triggers"]["cola"][] = "Serves cola been standing close to box of dryice ~1,3c ([today]/[total]/[sumtotal])";$this-&gt;serve["triggers"]["cola"][] = "Serves cola that been standing next to comp for few hrs ([today]/[total]/[sumtotal])";$this-&gt;serve["triggers"]["beer"][] = "Serves icecold beer ([today]/[total]/[sumtotal])";$this-&gt;serve["triggers"]["joint"][] = "Grabs a joint to [nick] from the stash ([today]/[total]/[sumtotal])";$this-&gt;serve["triggers"]["head"][] = ".h.e.a.d. ([total])";$this-&gt;serve["triggers"]["head"][] = "head for you sir. ([total])";        $this-&gt;serve["triggers"]["wine"][] = "pours up some fine stuff from the basement ([total])";        $this-&gt;serve["triggers"]["wine"][] = "here you are, found something out back ([total])";        $this-&gt;serve["triggers"]["wine"][] = "lucky you we just got one of this left enjoy ([total])";$this-&gt;serve["triggers"]["wine"][] = "so youre hit hard, where you want it ?, dont cry";$this-&gt;serve["triggers"]["mix"][] = "grinding up some weed for a mix ([total])";$this-&gt;serve["triggers"]["mix"][] = "grabs some the good stuff for a mix ([total])";$this-&gt;serve["triggers"]["mix"][] = "sneaks into g2x3ks stash and steals for a mix, here you go ([total])";$this-&gt;serve["triggers"]["mix"][] = "goes strain hunting in india for some good [censored] for your mix ([total])";$this-&gt;serve["triggers"]["mix"][] = "goes strain hunting in morocco for some good [censored] for your mix ([total])";$this-&gt;serve["triggers"]["pipe"][] = "goes strain hunting in morocco for some good [censored] for your pipe ([total])";        $this-&gt;serve["triggers"]["pipe"][] = "saw some [censored] in corner, fills a pipe ([total])";        $this-&gt;serve["triggers"]["pipe"][] = "skunky just arrieved peace all over ([total])";                $this-&gt;serve["triggers"]["whiskey"][] = "serves whiskey on the rocks ([total])";        $this-&gt;serve["triggers"]["whiskey"][] = "found some weird looking bottle in corner, might hit gold cheers ([total])";        $this-&gt;serve["triggers"]["whiskey"][] = "cola and bad whiskey for you ([total])";        $this-&gt;serve["triggers"]["pussy"][]= "slaps [nick] in face with a smelly pussy ([total])";$this-&gt;serve["triggers"]["pussy"][] = "Sends some pussy [nick]`s way .. ([total])";$this-&gt;serve["triggers"]["pussy"][] = "not enough money to suply you aswell ... ([total])";    $this-&gt;serve["triggers"]["icecream"][] = "here [nick]... one ball for you only ([today]/[total]/[sumtotal])";        $this-&gt;serve["triggers"]["icecream"][] = "finds a biig icecream for [nick] eat and you get for free (50$ to use toilet) ([today]/[total]/[sumtotal])";        $this-&gt;serve["triggers"]["icecream"][] = "dusts off something that look like icecream from the corner of fridge, here [nick] ([today]/[total]/[sumtotal])";// - docu:// [nick] = nick that triggered, [today] how many heads/coffee person had today// [total] = how many nick had it total, [last] time of last, [since] time since last// [sumtotal], [sumchannel], [sumnetwork] = how many all had// - reply syntax (random reply) :// $this-&gt;serve["triggers"]["coffee"]["replies"][] = "some reply here";// $this-&gt;serve["triggers"]["coffee"]["replies"][] = "another reply here";// - reply syntax - two line reply:// $this-&gt;serve["triggers"]["coffee"]["replies"][1] = "Line 1 of the reply 1";// $this-&gt;serve["triggers"]["coffee"]["replies"][1] = "Line 2 of the reply 1";// $this-&gt;serve["triggers"]["coffee"]["replies"][2] = "Line 1 of the reply 2";// $this-&gt;serve["triggers"]["coffee"]["replies"][2] = "Line 2 of the reply 2";// * [1/2] binds the two replies togeter must be incremented// - default settings syntax// $this-&gt;serve["settings"]["antispam"] = "1/3"; //1 trigger each 3 sec ...// $this-&gt;serve["settings"]["dateformat"] = "h:i:s";// - trigger settings syntax (overrides default settings if set)// $this-&gt;serve["triggers"]["coffee"]["settings"]["antispam"] = "1/60"; one a minute// $this-&gt;serve["triggers"]["coffee"]["settings"]["spamreplies"][] = "hey stop that iam burning my hands on this coffee ... one per minute shuld be enough";// set timer to clear "today" stats every 24hr// timer stuff//timerinfo for nxt day$args = new argClass();$args-&gt;timerid = strtotime(date("Y-m-d 00", time()+86400).":00:00");$settimer = $args-&gt;timerid-time();//start timers$this-&gt;ircClass-&gt;privMsg("#coders", "timer set to run at $args-&gt;timerid / ".date("Y-m-d H:i:s",$args-&gt;timerid));$this-&gt;timerClass-&gt;addTimer("serveclear" . $args-&gt;timerid, $this, "timer_serve", $args, $settimer, false);}public function timer_serve($args = false) {//clear daily stats$res = $this-&gt;db-&gt;query("UPDATE `layer13`.`servestats` SET `today` = '0'");$this-&gt;ircClass-&gt;privMsg("#coders", "cleared serve_today");//timerinfo for nxt day$args = new argClass();$args-&gt;timerid = strtotime(date("Y-m-d 00", time()+86400).":00:00");$settimer = $args-&gt;timerid-time();//start timers$this-&gt;ircClass-&gt;privMsg("#coders", "timer set to run at $args-&gt;timerid / ".date("Y-m-d H:i:s",$args-&gt;timerid));$this-&gt;timerClass-&gt;addTimer("serveclear" . $args-&gt;timerid, $this, "timer_serve", $args, $settimer, false);}public function priv_serve($line, $args) {$chan = strtolower($line['to']);$nick = $line['fromNick'];$address = $line["fromIdent"]."@".$line["fromHost"];$network = $this-&gt;ircClass-&gt;getServerConf ("NETWORK");// failsafes ...if (strpos ( $chan, "#" ) === false)return;if ($this-&gt;ircClass-&gt;getStatusRaw () != STATUS_CONNECTED_REGISTERED)return;if ($line['to'] == $this-&gt;ircClass-&gt;getNick())return; // dont work in private ...      foreach ($this-&gt;serve["triggers"] as $trigger =&gt; $reply) {if (preg_match("/(!|\.)$trigger\b/i", $line["text"])) {// parse trigger settings and replies$rid = rand(0, count($reply)-1);if (is_array($reply)) $reply = $reply[$rid];// check for nick in db$ures = $this-&gt;db-&gt;query("SELECT * FROM servestats WHERE nick LIKE ".sqlesc($nick)." AND network LIKE '$network' AND type LIKE ".sqlesc($trigger)." LIMIT 1");if (mysql_num_rows($ures) &gt;= 1) {$urow = mysql_fetch_assoc($ures);$nres = $this-&gt;db-&gt;query("UPDATE `layer13`.`servestats` SET `today` = today+1, `total` = total+1 WHERE `servestats`.`id` = $urow[id]");}else {// check for address in db'$ures = $this-&gt;db-&gt;query("SELECT * FROM servestats WHERE address LIKE ".sqlesc($address)." AND network LIKE '$network' AND type LIKE ".sqlesc($trigger)."");if (mysql_num_rows($ures) &gt;= 1) {$urow = mysql_fetch_assoc($ures);//$this-&gt;ircClass-&gt;privMsg("$chan", "found in db using address .. setting nick and updateing");$nres = $this-&gt;db-&gt;query("UPDATE `layer13`.`servestats` SET `today` = today+1, `total` = total+1, `nick` = ".sqlesc($nick)." WHERE `servestats`.`id` = $urow[id]");}else {// else add//$this-&gt;ircClass-&gt;privMsg("$chan", "not found in db ($nick - $address) .. adding");$ires = $this-&gt;db-&gt;query("INSERT INTO `layer13`.`servestats` (`id`, `nick`, `address`, `type`, `last`, `today`, `total`, `channel`, `network`) VALUES (NULL, ".sqlesc($nick).", ".sqlesc($address).", ".sqlesc($trigger).", UNIX_TIMESTAMP(), '1', '1', ".sqlesc($chan).", ".sqlesc($network).");");}}// grab info from db parse reply and return result$ures = $this-&gt;db-&gt;query("SELECT * FROM servestats WHERE nick LIKE ".sqlesc($nick)." AND network LIKE '$network' AND type LIKE ".sqlesc($trigger)." LIMIT 1");$urow = mysql_fetch_assoc($ures);//grap totals$tres = $this-&gt;db-&gt;query("SELECT sum(total) as sumtotal, sum(today) as sumtoday  FROM servestats WHERE network LIKE '$network' AND type LIKE ".sqlesc($trigger)." LIMIT 1");$trow = mysql_fetch_assoc($tres);$message = str_replace(array("[nick]", "[today]", "[total]", "[sumtotal]", "[sumtoday]"), array("$nick", $urow["today"], $urow["total"], $trow["sumtotal"],$trow["sumtoday"]), $reply);//lookup nick or insert, update stats and reply//$this-&gt;ircClass-&gt;privMsg("$chan", "trigger: $trigger - $reply @ $chan/$network");$this-&gt;ircClass-&gt;privMsg("$chan", "$message");}}}function addOrdinalNumberSuffix($num) {if (!in_array(($num % 100),array(11,12,13))){switch ($num % 10) {// Handle 1st, 2nd, 3rdcase 1:  return $num.'st';case 2:  return $num.'nd';case 3:  return $num.'rd';}}return $num.'th';}}?&gt;</code></pre></div>SQL Shcema (If it helps)<div class="codebox"><p>Code: </p><pre><code>CREATE TABLE IF NOT EXISTS `servestats` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `nick` varchar(32) CHARACTER SET latin1 NOT NULL,  `address` varchar(255) CHARACTER SET latin1 NOT NULL,  `type` varchar(255) CHARACTER SET latin1 NOT NULL,  `last` decimal(11,0) NOT NULL,  `today` int(11) NOT NULL,  `total` int(11) NOT NULL,  `channel` varchar(255) CHARACTER SET latin1 NOT NULL,  `network` varchar(255) CHARACTER SET latin1 NOT NULL,  PRIMARY KEY (`id`)) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8230">Fire-Fox</a> — Sat Apr 29, 2023 12:02 pm</p><hr />
]]></content>
	</entry>
	</feed>
