My bot sits in a private channel for gameserver admins and several public channels including a public channel for gameserver players. I want to use the same trigger in different channels but the responses will be different depending on what channel the trigger was called from.
In its current form, the trigger is
Code: Select all
!link <arg>
My current script is as follows
Code: Select all
bind pub - !link pub_link
proc pub_link {nick host hand chan arg} {
if {[string compare $chan #admin-channel]} {
return
}
global mysql
if {[llength $arg] < 1} then {
putquick "NOTICE $nick : You might want to tell me what link you want to look for....."
return
}
set extra [lindex $arg 0]
mysqlsel $mysql "SELECT trigger,link,details from irc_bot_links where trigger='$extra'"
set mycount [mysqlresult $mysql rows?]
mysqlmap $mysql {trigger link details} {
putquick "NOTICE $nick :$link - $details"
}
if {$mycount == 0} {
putquick "NOTICE $nick : No URL found for link $extra, for a list of links type !links"
}
}
Code: Select all
bind pub - !link pub_link
proc pub_link {nick host hand chan arg} {
if {[string compare $chan #admin-channel]} {
return
}
global mysql
if {[llength $arg] < 1} then {
putquick "NOTICE $nick : You might want to tell me what link you want to look for....."
return
}
set extra [lindex $arg 0]
mysqlsel $mysql "SELECT trigger,link,details from irc_bot_links where trigger='$extra' and status='private'"
set mycount [mysqlresult $mysql rows?]
mysqlmap $mysql {trigger link details} {
putquick "NOTICE $nick :$link - $details"
}
if {$mycount == 0} {
putquick "NOTICE $nick : No URL found for link $extra, for a list of links type !links"
}
elseif {[string compare $chan #public-channel]} {
return
}
global mysql
if {[llength $arg] < 1} then {
putquick "NOTICE $nick : You might want to tell me what link you want to look for....."
return
}
set extra [lindex $arg 0]
mysqlsel $mysql "SELECT trigger,link,details from irc_bot_links where trigger='$extra' and status='public'"
set mycount [mysqlresult $mysql rows?]
mysqlmap $mysql {trigger link details} {
putquick "NOTICE $nick :$link - $details"
}
if {$mycount == 0} {
putquick "NOTICE $nick : No URL found for link $extra, for a list of links type !links"
}
}
}
Can anyone offer any help or suggestions?
Regards
Reserve