| View previous topic :: View next topic |
| Author |
Message |
JKM Voice
Joined: 06 Dec 2008 Posts: 30
|
Posted: Wed Dec 17, 2008 12:13 pm Post subject: Need some help with this join script |
|
|
Hi there,
I started on a join script, and was wondering about how I should write the "if {ChanServ JOIN}".
| Code: | bind msg - ?join join_proc
proc join_proc { nick chan arg }
if {ChanServ ison $chan} {
putquick "PRIVMSG $nick :ChanServ ison chan!"
} else {
putserv "JOIN $chan"
}
if {ChanServ JOINS} {
putquick "PRIVMSG $chan :ChanServ joined!"
putserv "PART $chan"
}
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Dec 17, 2008 4:39 pm Post subject: |
|
|
| Code: | if {[string equal -nocase "chanserv" $nick]} {
# $nick is ChanServ
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
JKM Voice
Joined: 06 Dec 2008 Posts: 30
|
Posted: Wed Dec 17, 2008 7:26 pm Post subject: |
|
|
So.. | Code: | proc join_proc { nick chan arg }
if {ChanServ ison $chan} {
putquick "PRIVMSG $nick :ChanServ ison chan!"
} else {
putserv "JOIN $chan"
}
if {[string equal -nocase "chanserv" $nick]} {
# $nick is ChanServ
putquick "PRIVMSG $chan :ChanServ joined!"
putserv "PART $chan"
}
} |
|
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Dec 17, 2008 7:39 pm Post subject: |
|
|
You want your bot to check if ChanServ is in the channel when the bot joins? _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Dec 29, 2008 6:54 am Post subject: |
|
|
For the {Chanserv JOINS} test, use the code suggested by Sir_Fz.
For the {ChanServ ison $chan} test, use this:
| Code: | | if {[onchan ChanServ $chan} { |
Further; this will not produce the desired result:
| Code: | | putserv "JOIN $chan" |
This will only cause your eggdrop to join the channel, only to get confused and leave it instantly; use the channel add command instead.
Same goes for this:
| Code: | | putserv "PART $chan" |
Use channel remove instead.
Finally, your argument-list does not match the kind of binding you're using, msg bindings calls the proc with the following parameters, nick host handle text.
It should be something like this:
| Code: | | proc join_proc {nick host handle text} { |
Finally, I don't see chan defined anywhere whithin your proc. Were you thinking of taking whatever is written after ?join as the channel-name? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Dec 29, 2008 8:32 am Post subject: |
|
|
The problem with using [onchan] here is that the bot won't have the chanlist generated yet when it first joins. So [onchan] will return 0 even if ChanServ is actually in the channel. One solution would be to delay the check for a few seconds... _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|