This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Tcl Problem: Command for the user count on a channel

Old posts that have not been replied to for several years.
Locked
D
Domian

Tcl Problem: Command for the user count on a channel

Post by Domian »

Hello,
I need a Tcl command, where the bot tell me the user count on a channel. not a peak script,
but the user count.

example:
5 ops,
2 voice,
20 other user.

I need this for a Bot request script.
a user post !request botname #channel
the requestbot join den channel.
if there more than 10 user
the requestbot leave the chan
and the bot with the botname join the channel,
thats is,
and for this I need a script.
The Beginning is finished,
but the requestbot will'nt join the channel,
and i dont know how much user are on the channel.

I hope anyone can help me.
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Code: Select all

bind dcc - chanstat dcc:chanstat
proc dcc:chanstat {hand idx text} {
 set chan [lindex [split $text] 0]
 if {$chan == ""} {
   putidx $idx "Usage: .chanstat <#channel>"
   return
 }
 set ops 0; set voice 0; set users 0
 foreach user [chanlist $chan] {
   if {[isop $user $chan]} {
     incr ops
   } elseif {[isvoice $user $chan]} {
     incr voice
   } else {
     incr users
  }
 }
 set total [expr $ops+$voice+$users]
 putidx $idx "ChanStats $chan: $ops ops, $voice voice, $users users (total $total)"
}
D
Domian

Post by Domian »

Thank you,

Another Problem: :D

Code: Select all

           if {[string first $requestbot $botnicks] != -1} {
             if {$channel != ""} {
               if {$email != ""} {
                 putserv "NOTICE $nick :Request send."
                 join $channel
                 putserv "NOTICE $nick :The Bot will soon join."
                 putserv "PRIVMSG $requestbot :.join $channel"
                 putserv "PRIVMSG $requestbot :.adduser $nick $userhost"
                 putserv "PRIVMSG $requestbot :.chattr $nick +n $channel"
The bot send the notice, but he doesn't join.
where is the mistake?

The Script with the user is after the join command.
The bot join the Channel,
look the user count,
and if there more than 10 user,
the $requestbot will join,
Last edited by Domian on Sun Oct 24, 2004 5:39 am, edited 1 time in total.
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

if the bot is sending the replys or the data i am asuming to the ohter bot .. then you should check that other bot..
XplaiN but think of me as stupid
D
Domian

Post by Domian »

No,

Code: Select all

                 putserv "NOTICE $nick :Request send." 
                 join $channel 
                 putserv "NOTICE $nick :The Bot will soon join." 
The bot send the first notice, after 3 seconds the bot send the second notice,
But he doesn't join the channel. and the join command is inside the notices.
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

The command is not "join", which by the way, is not a tcl command. The command you seek is channel add, read all about it in tcl-commands.doc :wink:
D
Domian

Post by Domian »

Thx, The bot joint now the channel.

Code: Select all

                 putserv "NOTICE $nick :Request send."
                 channel add $channel
                 putserv "NOTICE $nick :The Bot will soon join."
                 putbot $requestbot .join $channel"
                 putbot $requestbot .adduser $nick $userhost"
                 putbot $requestbot .chattr $nick +n $channel"
So,
But how I told the Bot that he look the user count,
and if the user count ist higher than 10 he give the user the flags.
but if in the channel are less than 10 user, they part.

Can you help me?
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

yanno, you will never, ever be able to write this script without FIRST reading tcl-commands.doc. This document is vital for the scripter... every question you have asked could be answered with the information contained within that doc.... and then some.
The script you seek to create, believe it or not, has already been written, for the most part, as a netbots component by Johoho named cdiss.tcl... I'm sure it would be easier for you to rewrite this tcl than to write your own. :mrgreen:
D
Domian

Post by Domian »

:D
Yes, I learn Tcl ^^
Thank you for the Help file.
I read that now.

But The Script isn't that what I want.
Here ist the full script:

Code: Select all

# BotRequest by Domian 
# #Domi @ Quakenet
# Version 0.1

# Command:
# !request <Bot> <#Channel> <e-mail adresse>

# Settings

set botnicks "Bello` KriXDesiGn"
# Here are the Botnicks which can requested

# Here beginn the script

bind pub -|- !request pub:request

proc pub:request {nick uhost handle chan text} {
global botnicks receiver waittime
  set ipmask [lindex [split [maskhost $nick![getchanhost $nick $chan]] "@"] 1]
  set userm [lindex [split [getchanhost $nick $chan] "@"] 0]
  set userhost *!*$userm@$ipmask
  set requestbot [lindex [split $text " "] 0]
  set channel [lindex [split $text " "] 1]
  set email [lindex [split $text " "] 2]
    if {$requestbot == ""} {
      putserv "NOTICE $nick :Wrong !request-format."
      putserv "NOTICE $nick :To request use: 4!request <bot-nick> #channel <e-mail adresse>"
      putserv "NOTICE $nick :You also need an e-mail acc and 10 or more Members in the requested channel."
      } else {
      if {$channel == ""} {
        putserv "NOTICE $nick :Wrong !request-format."
        putserv "NOTICE $nick :To request use: 4!request <bot-nick> #channel <e-mail adresse>"
        putserv "NOTICE $nick :You also need an e-mail acc and 10 or more Members in the requested channel."
        } else {
        if {[string first "#" $channel] == -1} {
          putserv "NOTICE $nick :Wrong !request-format."
          putserv "NOTICE $nick :To request use: 4!request <bot-nick> #channel <e-mail adresse>"
          putserv "NOTICE $nick :You also need an e-mail acc and 10 or more Members in the requested channel."
          } else {
           if {[string first $requestbot $botnicks] != -1} {
             if {$channel != ""} {
               if {$email != ""} {
                 putserv "NOTICE $nick :Request send."
                 channel add $channel
                 set total [llength [chanlist $channel]]
                 if { $total >= 10} {  
                   putserv "NOTICE $nick :The Bot will soon join."
                   putbot $requestbot .join $channel"
                   putbot $requestbot .adduser $nick $userhost"
                   putbot $requestbot .chattr $nick +n $channel"
                   }} else {
                     putserv "NOTICE $nick :The Channel is to small, the Bot won't join"
               }
             }
             } else {
             putserv "NOTICE $nick :You typed a wrong bot-nick. Known bot-nick's are:"
             putserv "NOTICE $nick :$botnicks"
           }
         }
       }
     }
   }

putlog "Loaded BotRequest 0.1 by Domian"
Do you know now what I will?
The bot join the channel, and he send the first notice.
But the user count script ...
there ist a mistake.

Sorry for my bad english...
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

YooHoo wrote:join is not a tcl command.
wrong.
Domian wrote:

Code: Select all

channel add $channel
set total [llength [chanlist $channel]]
This will not work, as the bot won't join the channel before your proc returns. After joining, eggdrop will perform /MODE #chan +b, /MODE #chan, /WHO #chan. "chanlist" will not be complete untill the END OF /WHO reply (315) is recieved by your bot. You need a delay or a raw bind to make sure you don't check the llength of [chanlist $channel] untill the list is complete. (so you'll need to split your code into two procs)
Have you ever read "The Manual"?
D
Domian

Post by Domian »

Yes I understand,
But I dont know much from tcl.
So,
I dont know how I script this,
Do you can help me?

Code: Select all

         bind raw <flags> <keyword-mask> <proc>
         procname <from> <keyword> <text>
this is the command. I know and this come in a new file.
But how I set the values?
and how I link the 2 scripts?
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

The topic seems abit off, you don't have a problem, you just want us to make half your script :x
D
Domian

Post by Domian »

Mhm, Sorry
It's not my mind.

Thx for the help

If anybody will help me:
demian@demian-hartmann.de

*closed*
Locked