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 

topic script

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
DaRkOoO
Halfop


Joined: 27 Sep 2008
Posts: 67

PostPosted: Mon Mar 30, 2009 6:09 pm    Post subject: topic script Reply with quote

Hello everyone..

I'm using this tcl for topic:

Code:
bind pub - !topic holm-pub_topic
proc holm-pub_topic {nick uhost handle channel text} {
global botnick voice_chan voice_flag
      if {[isvoice $nick $channel]} {
         if {$text == ""} {
            puthelp "NOTICE $nick :Usage: !topic <topic>"
         return 0
         }
         if {[isop $botnick $channel] == "0"} {
            puthelp "NOTICE $nick :Sorry, I'm not a op on $channel."
         return 0
         }
         if {[isop $botnick $channel] == "1"} {
            putserv "TOPIC $channel :$nick: $text"
            putlog "#$nick# !topic $text"
         }
      }
   }


Now,I need : If someone try to use !topic with word channel or http or www or #,bot should ban him(and don't set that one topic ofc)

Regards,
Darko.
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Mon Mar 30, 2009 7:44 pm    Post subject: Reply with quote

I haven't tested it but should be OK. Give it a try please

Code:

set vHolmBanTime 10

set vHolmBadTopic {
    "html"
    "#"
    "www"
    "channel"
}

bind PUB - !topic pHolmTopic

proc pHolmTopic {nick uhost hand channel txt} {
    global botnick vHolmBadTopic vHolmBanTime
    if {([isvoice $nick $channel]) || ([isop $nick $channel])} {
        set topic [string trim $txt]
        if {[llength [split $topic]]] != 0} {
            if {[botisop $channel]} {
                foreach word $vHolmBadTopic {
                    if {[string match -nocase "*$word*" $topic]} {
                        newchanban $channel $nick!*@* $botnick "bad topic *$word*" $vHolmBanTime
                        return 0
                    }
                }
                putserv "TOPIC $channel :$nick \:$topic"
                putlog "#$nick# !topic $topic"
            } else {puthelp "NOTICE $nick :-error- Bot needs to be an op on $channel to change the topic"}
        } else {puthelp "NOTICE $nick :-error- Correct syntax is !topic <topic>"}
    } else {puthelp "NOTICE $nick :-error- Only channel voices or above are allowed to change the topic"}
    return 0
}

_________________
I must have had nothing to do
Back to top
View user's profile Send private message
DaRkOoO
Halfop


Joined: 27 Sep 2008
Posts: 67

PostPosted: Tue Mar 31, 2009 9:02 am    Post subject: Reply with quote

Works,just this line
Code:
if {[llength [split $topic]]] != 0} {
should be
Code:
if {[llength [split $topic]] != 0} {


And now I need to be able to specify it just for one,or two channels,and to make bot dont kick/ban his owner[s].. Smile))
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Tue Mar 31, 2009 11:27 am    Post subject: Reply with quote

Please excuse the extra close bracket in my earlier code. My editor should have picked up on that.

Now will work only in channels with the special flag set in the bot's partyline as follows :-

.chanset #channelname +topic

Now will exempt users with whatever global bot flag is set in the configuration section

Code:

# *** Configuration *** #

# duration of bans in minutes
set vHolmBanTime 10

# global bot flag to exempt from bad topic ban
# o = global operator
# m = global master
# n = global owner
set vHolmExemptFlag n

# list of bad topic words/phrases
set vHolmBadTopic {
    "html"
    "#"
    "www"
    "channel"
}

# *** Code *** #

setudef flag topic

bind PUB - !topic pHolmTopic

proc pHolmTopic {nick uhost handle channel txt} {
    global botnick vHolmBadTopic vHolmBanTime vHolmExemptFlag
    if {[channel get $channel topic]} {
        if {([isvoice $nick $channel]) || ([isop $nick $channel])} {
            set topic [string trim $txt]
            if {[llength [split $topic]] != 0} {
                if {[botisop $channel]} {
                    if {![matchattr $handle $vHolmExemptFlag]} {
                        foreach word $vHolmBadTopic {
                            if {[string match *$word* $txt]} {
                                newchanban $channel $nick!*@* $botnick "bad topic *$word*" $vHolmBanTime
                                return 0
                            }
                        }
                    }
                    putserv "TOPIC $channel :$nick \:$topic"
                    putlog "#$nick# !topic $topic"
                } else {puthelp "NOTICE $nick :-error- I need to be an op on $channel to change the topic"}
            } else {puthelp "NOTICE $nick :-error- Correct syntax is !topic <topic>"}
        } else {puthelp "NOTICE $nick :-error- Only channel voices or above are allowed to change the topic"}
    }
    return 0
}


I'm sure stuff like this has been written before in the vast Tcl archive on this site. I sort of feel I'm reinventing the wheel.
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
DaRkOoO
Halfop


Joined: 27 Sep 2008
Posts: 67

PostPosted: Tue Mar 31, 2009 12:20 pm    Post subject: Reply with quote

Works fine,thanks Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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