| View previous topic :: View next topic |
| Author |
Message |
slowpoke23 Voice
Joined: 10 Feb 2013 Posts: 5
|
Posted: Sun Feb 10, 2013 5:22 am Post subject: Reply to the command |
|
|
OK so I have the following code, How can I make it reply to say !getaops #ChaNneL2 when its set as #channel2 in the script
And if its not set to #Channel3 and someone does !getaops #channel3 can it return a error?
| Quote: | bind pub n !getaops get_aops
proc get_aops {nick uhost hand chan text} {
global botnick
set aop [lindex $text 0]
if {$aop == "#channel2"} {
putserv "privmsg $chan :omg the ops for this channel are name name2"
}
} |
|
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Feb 10, 2013 5:26 am Post subject: |
|
|
Ok so every use can use !getaops #channel2 (if any user uses this command but instead of #channel2 he add something else he will receive another message)
Removed the part where only admins can use this command
| Code: |
bind pub - !getaops get_aops
proc get_aops {nick uhost hand chan text} {
set aop [lindex [split $text] 0]
if {$aop == "#channel2"} {
putserv "PRIVMSG$chan :omg the ops for this channel are name name2"
} else {
putserv "PRIVMSG $chan :valid command !getaops #channel2"
}
}
|
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
slowpoke23 Voice
Joined: 10 Feb 2013 Posts: 5
|
Posted: Sun Feb 10, 2013 5:31 am Post subject: |
|
|
Hi, Thanks.
I plan on having a few channels on this script like #chan1 #chan2 #lobby #help #network etc so I'm not sure how it'd be done that way? |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Feb 10, 2013 5:37 am Post subject: |
|
|
Well if you want different messages for every !getaops i recommand this script http://forum.egghelp.org/viewtopic.php?t=19313
It allows you to create !getaops for every channel but with different reply messages
So you would do something like this
First activate the script on every channel you want it working
Then create teh !getaops command
| Quote: | | !trigger getaops Aops are: .. .. .. |
And now any user could use in the channel command
I think its simple beside what you have. But if you prefer i can modify that script to work on more channel yet it will be harder for you to look at the code and modify the text later or add other channels _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
slowpoke23 Voice
Joined: 10 Feb 2013 Posts: 5
|
Posted: Sun Feb 10, 2013 5:42 am Post subject: |
|
|
Hmm that script could become handy but !getaops will only be available in one channel which will be a chanops channel.. so i don't think !trigger etc will be any help
I appreciate your help! |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Feb 10, 2013 5:53 am Post subject: |
|
|
Ok well the code should look like
So if you want something more please reply
| Code: |
bind PUB - !getaops getaops:pub
set temp(#channel1) "text text text"
set temp(#channel2) "some other text"
proc getaops:pub {nick uhost hand chan arg} {
global temp
set who [lindex [split $arg] 0]
if {[string match "#*" $who] && [info exists temp($who)]} {
putserv "PRIVMSG $chan :$temp($who)"
} else {
set list ""
foreach a [array names temp] { lappend list $a }
putserv "PRIVMSG $chan :Valid channels are: [join $list ", "]"
}
}
|
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
slowpoke23 Voice
Joined: 10 Feb 2013 Posts: 5
|
Posted: Sun Feb 10, 2013 6:02 am Post subject: |
|
|
Thank you!! That is what I'm after pretty much !
Just one minor problem if you don't mind helping just a little bit more..
[20:00:58] <%SUme> !getaops #ChaNnel2
[20:01:00] <&Botes> Valid channels are: #channel1, #channel2
[20:01:04] <%SUme> lulz
Is there any way it if someone did say #ChaNnel2 it will reply back with #channel2 info? |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Feb 10, 2013 6:05 am Post subject: |
|
|
Ok this should work.
Yet i tell you to keep
set temp(#channel-name) with lowercases then after on the channel users can use whatever they want like #ChaNNel-Name it would still work
| Code: |
bind PUB - !getaops getaops:pub
set temp(#channel1) "text text text"
set temp(#channel2) "some other text"
proc getaops:pub {nick uhost hand chan arg} {
global temp
set who [lindex [split $arg] 0]
if {[string match "#*" $who] && [info exists temp([string tolower $who])]} {
putserv "PRIVMSG $chan :$temp($who)"
} else {
set list ""
foreach a [array names temp] { lappend list $a }
putserv "PRIVMSG $chan :Valid channels are: [join $list ", "]"
}
}
|
Test it and tell me if its working _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
|