| View previous topic :: View next topic |
| Author |
Message |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Thu Jun 21, 2007 9:45 am Post subject: Random MSG |
|
|
I need a small script which will make my bot msg randomly anyone in the channel after every x minutes op/voices are exempted they wont be msged by the bot. One more thing, if the bot msgs someone then it wont msg that nick until that nick parts the channel or quits from IRC.
is it possible that you create me this small script.
Thanks
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Thu Jun 21, 2007 11:11 am Post subject: |
|
|
| Code: | set randmsg(time) 10
set randmsg(chan) #channel
set randmsg(msgs) {
"msg 1"
"msg 2"
"msg 3"
}
bind time - * send:msg
bind part - * rem:nick
bind sign - * rem:nick
bind kick - * rem:nick
proc send:msg {m h args} {
global randmsg
if {([scan $m %d]+([scan $h %d]*60)) % $randmsg(time) == 0} {
set cl [split [string tolower [join [chanlist $randmsg(chan)]]]]
set cll [llength $cl]
set n [lindex $cl [rand $cll]]
while {[set c [expr {[isvoice $n $randmsg($chan)] || [isop $n $randmsg(chan)] || [info exists randmsg(n:$n)]}]]} {
set i [lsearch -exact $cl $n]
set cl [lreplace $cl $i $i]
if {[incr cll -1] < 1} {break}
set n [lindex $cl [rand $cll]]
}
if {!$c} {
puthelp "privmsg $n :[lindex $randmsg(msgs) [rand [llength $randmsg(msgs)]]]"
set randmsg(n:$n) 1
}
}
}
proc rem:nick {nick uhost hand chan arg {rsn ""}} {
global randmsg
if {$rsn != ""} { set nick $arg }
if {[info exists randmsg(n:[set nick [string tolower $nick]])]} {
unset randmsg(n:$nick)
}
} |
Edit: Now it should not msg ops/voices and nicks that have already been msged unless they part/quit.
Edit2: Fixed error.
Edit3: Added refresh list on kick as well. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts
Last edited by Sir_Fz on Fri Jun 22, 2007 7:48 pm; edited 5 times in total |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Jun 22, 2007 4:53 am Post subject: |
|
|
Thanks alot SirFz, let me put it in the bot and will let you know if I find any problem.
Thanks once again.
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Jun 22, 2007 8:39 am Post subject: |
|
|
The problem is that the bot is msging itself and also it's messagin the ops and voiced users. How can I make it not msg itself and op/voice users.
also it is msging users always, can't we restrict it so that if the bot msged one user it shouldnt msg him/her anymore until that nick parts or quits
I did this to find out:
| Code: | puthelp "privmsg $n :[lindex $randmsg(msgs) [rand [llength $randmsg(msgs)]]]"
putlog "Just msged $n"
set randmsg(n:$n) 1 |
I found out:
| Code: | [17:37] <ShetanGal> [17:38] Just msged lair
[17:38] <ShetanGal> [17:39] Just msged cancerian
[17:39] <ShetanGal> [17:40] Just msged cheetah
[17:40] <ShetanGal> [17:41] Just msged shetangal
[17:41] <ShetanGal> [17:42] Just msged lair
[17:42] <ShetanGal> [17:43] Just msged alone_m_isb |
You see the nickname lair comes 2 times lair is an op too and bot msges itself as it's nickname is ShetanGal.
Thanks _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Jun 22, 2007 2:07 pm Post subject: |
|
|
thanks alot, it's working smooth now
Thank you soo much
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Jun 22, 2007 6:01 pm Post subject: |
|
|
| Code: | [03:02] <ShetanGal> [03:03] Tcl error [send:msg]: random limit must be greater than zero
[03:03] <ShetanGal> [03:04] Tcl error [send:msg]: random limit must be greater than zero
[03:04] <ShetanGal> [03:05] Tcl error [send:msg]: random limit must be greater than zero |
This is what I get in DCC any idea?
thanks
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Jun 22, 2007 6:43 pm Post subject: |
|
|
I edited the code and the error must not appear anymore. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Fri Jun 22, 2007 7:38 pm Post subject: |
|
|
Thanks alot, it's working perfect now.
Thank you soo much
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri Jun 22, 2007 7:49 pm Post subject: |
|
|
I've edited it again and added removing the nick from the already-msged nicks if it is kicked. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
iamdeath Master

Joined: 11 Feb 2005 Posts: 323 Location: *HeLL*
|
Posted: Sun Jun 24, 2007 6:15 am Post subject: |
|
|
Thank you soo much SirFz, I really appreciate your efforts.
Thank You
iamdeath _________________ |AmDeAtH @ Undernet
Death is only the *Beginning*... |
|
| Back to top |
|
 |
|