egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delayed /whois queing of channel users

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Mon Jul 23, 2007 10:28 pm    Post subject: Delayed /whois queing of channel users Reply with quote

Suppose I want to perform a task of whois all channel users on all channels the bot is on. Some channels may have user counts 100+ as well.

This task might slow the bot, I can manually at utimers and check for each channel with a delay, but how to make this system automated? Any idea? to help for the delay queing. Suppose I want to delay 2mins between the /whois check for every channel. Can't seem to get anything in my head currently, maybe because its just 8:30am here, heh.

Code:

bind time - "*" check:ascii:time

proc check:ascii:time {m h d mo y} {
 #check the time interval to perform the scan
 if {([scan $m %d]+([scan $h %d]*60)) % 10 == 0} {

 #whois channel users
 foreach chan [split [string tolower [channels]]] {
  foreach user [chanlist $chan] {
    if {![isbotnick $user] && ![isop $user $chan] && ![isvoice $user chan]} {
        puthelp "WHOIS $user"
        }
      }
    }
  }
}


What I can do is add an array for each channel containing their user list:

Code:

set userlist [list]
 foreach chan [split [string tolower [channels]]] {
  foreach user [chanlist $chan] {
    if {![isbotnick $user] && ![isop $user $chan] && ![isvoice $user chan]} {
     lappend userlist($chan) $user
    }
  }
}     


Now I got the channel user lists in an array, then how to whois every channels array with a specific delay of time in between? The reason is I don't want to whois every channels users at the one time, will heap the queue.
_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jul 24, 2007 6:38 am    Post subject: Reply with quote

Add the channels into a list as well and create a timer which will perform a whois on each channel every 2 minutes (you'll remove the channel from the list each time). Example
Code:
if {![info exists chanlist] || $chanlist == {}} {
 set chanlist [channels]
}
# whois array of channel at index 0 in $chanlist
# remove the first element from $chanlist
set chanlist [lreplace $chanlist 0 0]
# timer to call proc again...

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Tue Jul 24, 2007 11:01 am    Post subject: Reply with quote

Ah thanks Sir_Fz, I will try to implement that.
_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Sun Aug 05, 2007 10:56 pm    Post subject: Reply with quote

Sir_Fz wrote:
Add the channels into a list as well and create a timer which will perform a whois on each channel every 2 minutes (you'll remove the channel from the list each time). Example
Code:
if {![info exists chanlist] || $chanlist == {}} {
 set chanlist [channels]
}
# whois array of channel at index 0 in $chanlist
# remove the first element from $chanlist
set chanlist [lreplace $chanlist 0 0]
# timer to call proc again...


Okay I devised something like this, just to let you know:

Code:

proc check:ascii:time {m h d mo y} {
 #check the time interval to perform the scan
 if {([scan $m %d]+([scan $h %d]*60)) % 30 == 0} {

 #set list of channels to whois
 set chanlist [list "#awyeah #miri #urdu"]
 set chanlist [split [string tolower $chanlist]]

 #set whois timer
 set chanwhois 5

 #whois each channel
 foreach chan $chanlist {
  utimer $chanwhois [list whois:ascii:users $chan]
  incr chanwhois 5
  }
 }
}

proc whois:ascii:users {chan} {
 if {[botonchan $chan] && [botisop $chan]} {
  foreach user [chanlist $chan] {
    if {![isbotnick $user] && ![isop $user $chan] && ![isvoice $user $chan] && ![matchattr [nick2hand $user $chan] mn|mn $chan]} {
      puthelp "WHOIS $user"
      }
    }
  }
}


Didn't find a need remove the channel names from the list though.
_________________
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Aug 06, 2007 5:19 pm    Post subject: Reply with quote

You didn't really apply my idea, you created your own Wink Also
Code:
set chanlist [split [string tolower $chanlist]]

$chanlist is a list, so don't apply a [string] command over it (use [join] to convert it to a string). Besides, it's already lowercase so there's no need to apply [string tolower] over it anyway.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber