| View previous topic :: View next topic |
| Author |
Message |
T-Xorcist Halfop
Joined: 14 Nov 2005 Posts: 47 Location: Netherlands
|
Posted: Thu Jan 05, 2006 11:04 am Post subject: Weird bot problem |
|
|
Hi guys/girls,
I have the following script:
| Code: | proc msg:join {nick host hand text} {
set chan [lindex $text 0]
if {[botonchan $chan]} {
putquick "NOTICE $nick :I am allready on \002$chan\002"
return 1
}else{
putquick "PRIVMSG #bots :I have been invited into \002$chan\002 by \002$nick\002"
putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
channel add $chan
}
}
|
The weird thing is, that it worked 1 time, after that it didn't work anymore.
What am I doing wrong? Because when I start the bot, it doesn't give any errors.
The problem accured when I added the ... if {[botonchan $chan]} { line ...
Thanks in advance! _________________ is-1337.org IRC server! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jan 05, 2006 1:19 pm Post subject: |
|
|
You got an error after adding that line but didn't bother to show it here. Replace
with
or just
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
T-Xorcist Halfop
Joined: 14 Nov 2005 Posts: 47 Location: Netherlands
|
Posted: Thu Jan 05, 2006 11:44 pm Post subject: |
|
|
Tried it. After I restart the bot, it lissens to me 1 time (parting the channel). After that, it seems it crashes :S
I really do not get the problem
UPDATE: It doesn't even connect to the IRC server right now... This is a very weird problem I guess... This happened why I tried the } { thing  _________________ is-1337.org IRC server! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Jan 06, 2006 9:13 am Post subject: |
|
|
Is that even a problem from the script? What do you mean crashes? any errors?
Also, I recommend you to split text when setting chan.
| Code: | | set chan [lindex [split $text] 0] |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
T-Xorcist Halfop
Joined: 14 Nov 2005 Posts: 47 Location: Netherlands
|
Posted: Fri Jan 06, 2006 12:47 pm Post subject: |
|
|
Well, it doesn't work as it supposed to.
When I type /msg botnick join #channel it doesn't respond at all.
But if I use a channel where it is allready in, it gives me response that he is allready in that channel.
So, if the bot is in the channel, it responds with: I am allready in #channel.
But if he is not, he doesn't give me response and doesn't join the channel.
Exactly the same problem with the parting area. It parts the channel if he is on that channel. But if he is NOT on the channel, it doesn't give me a response. After the else, it is going wrong. I guess he doesn't like the } else { part
For better understanding, here is the whole script:
| Code: | bind msg - join msg:join
bind msg m part msg:part
proc msg:join {nick host hand text} {
set chan [lindex [split $text] 0]
if {[botonchan $chan]} {
putquick "NOTICE $nick :I am allready on \002$chan\002"
} else {
putquick "NOTICE $nick :You invited me to join \002$chan\002. Joining..."
channel add $chan
}
}
proc msg:part {nick host hand text} {
set chan [lindex [split $text] 0]
if {[botonchan $chan]} {
putquick "PRIVMSG $chan :Leaving channel... (Removed by T-Xorcist)"
channel remove $chan
} else {
putquick "NOTICE $nick :I am not on \002$chan\002"
}
} |
_________________ is-1337.org IRC server! |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Jan 06, 2006 1:01 pm Post subject: |
|
|
That's because it's not a validchan (doesn't exist in bot's chanfile).
| Code: | bind msg - join msg:join
bind msg - part msg:part
proc msg:join {nick uhost hand arg} {
set c [lindex [split $arg] 0]
if {[validchan $c]} {
puthelp "notice $nick :$c is already in my chanfile."
} {
channel add $c
puthelp "notice $nick :$c has been succesfully added to my chanfile."
}
}
proc msg:part {nick uhost hand arg} {
set c [lindex [split $arg] 0]
if {[validchan $c]} {
channel remove $c
puthelp "notice $nick :$c has been succesfully removed from my chanfile."
} {
puthelp "notice $nick :$c does not exist in my chanfile."
}
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
T-Xorcist Halfop
Joined: 14 Nov 2005 Posts: 47 Location: Netherlands
|
Posted: Fri Jan 06, 2006 1:09 pm Post subject: |
|
|
Great! It works now. Very much appreciated!  _________________ is-1337.org IRC server! |
|
| Back to top |
|
 |
|