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
Football
Master


Joined: 26 Dec 2008
Posts: 205
Location: Quakenet, #Football

PostPosted: Tue Feb 09, 2010 2:38 pm    Post subject: Topic script Reply with quote

Hey,

I couldn't find a regula, simple script, that allows flag "v" to change a selected channel's topic via private message.

Would be glad if anyone could help, shouldn't be a long script right?
_________________
Idling at #Football, Quakenet.
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Tue Feb 09, 2010 3:24 pm    Post subject: Reply with quote

I just use a this simple bit of script to do channel topics

Code:
bind msg v|v topic cmd:topic
proc cmd:topic {nick uhost hand arg} {
  set chan [lindex [split $arg] 0] 
  set text [join [lrange [split $arg] 1 end]] 
  putserv "TOPIC $chan :$text" 
}


/msg botnick topic #chan topic text
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue Feb 09, 2010 6:46 pm    Post subject: Reply with quote

Code:
setudef flag mytopic

bind msg v|v topic cmd:topic

proc cmd:topic {nick uhost hand arg} {
   set chan [lindex [split $arg] 0]
   set text [join [lrange [split $arg] 1 end]]
   if {[string match *[string index $chan 0]* "#&"]} {
      if {[validchan $chan] && [botison $chan]} {
         if {[botisop $chan]} {
            if {[channel get $chan mytopic]} {
               if {[onchan $nick $chan]} {
                  putserv "TOPIC $chan :$text"
               } else {
                  putserv "NOTICE $nick :You need to be in the channel to witness the topic change. Nice try. :P"
               }
            } else {
               putserv "NOTICE $nick :You CANNOT change topic of $chan. Nice try."
            }
         } else {
            putserv "NOTICE $nick :I'm not op of $chan so no topic change for you. :P"
         }
      } else {
         putserv "NOTICE $nick :I'm not on $chan. How do you expect me to change topic?!"
      }
   } else {
      putserv "NOTICE $nick :What is $chan? That doesn't look like any IRC channel I've ever seen. :P"
   }
}

Here's the same script with some extra checks to make sure users aren't causing your bot to send garbage to the IRCD.
To get it to work in #yourchan: .chanset #yourchan +mytopic
After that, it will work for users with voice in #yourchan. Other users cannot manipulate your bot without being in it's presence.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Football
Master


Joined: 26 Dec 2008
Posts: 205
Location: Quakenet, #Football

PostPosted: Wed Feb 10, 2010 12:47 pm    Post subject: Reply with quote

That doesn't seem to work, even though I used .chanset #EPL +mytopic and added the user with a +v flag, and he is voiced on the channel.


[17:45] Tcl error [cmd:topic]: invalid command name "botison"
_________________
Idling at #Football, Quakenet.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Feb 10, 2010 2:32 pm    Post subject: Reply with quote

Replace "botison" with "botonchan".
_________________
Follow me on GitHub

- Opposing

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


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed Feb 10, 2010 6:05 pm    Post subject: Reply with quote

Sir_Fz wrote:
Replace "botison" with "botonchan".

DOH! Sir_Fz to the rescue.. Wink
Thanks for the save.. keke
_________________
speechles' eggdrop tcl archive
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