Topic Changer

By Rayquaza on Apr 20, 2010

Hello, this is my first post! =)
There are a few things for this...

  1. Need a Bot. Set the %botnick variable
  2. Need to be a op on a channel
  3. Has to be put in remote

Thanks to Wariopower for some tips. Enjoy!
~ Rayquaza ~

alias setbot { set %botnick $$?="What's your bot's name?" }

on *:TEXT:!topic*:#: {
  if ($nick isop $chan) && ($me == %Botnick) {
    topic # $2-
  }
  elseif ($nick !isop $chan) && ($me == %Botnick) {
    notice $nick You aren't an op. No topic for you.
  }
}

Comments

Sign in to comment.
Bielie   -  Apr 22, 2010

mistake there lol.... I fixed it :D

 Respond  
Cheiron   -  Apr 22, 2010

amen to that.. i would use > if ($address == your@addy/vhost.here) myself to avoid the impersonation attempts. more secure

 Respond  
WorldDMT   -  Apr 22, 2010

($nick == $me)

on text event !!! lol

 Respond  
Bielie   -  Apr 22, 2010

or you run 2 connections and run the bot and ur own nick at the same time?

Why would you change ur nick? Looks kinda stupid if a bot talks normal sjet u know :P....

And that command works fine....

 Respond  
gooshie   -  Apr 22, 2010
 on $*:text:/^[.!@]topic\b/iS:#: {
  if ($nick isop $chan) && ($nick == $me) {

This will never trigger as you can't trigger your own text event.

My guess is the original code ($me == %Botnick) is usefull if you
wish to chat normally and then when you decide to play bot then
renick to the botnick and let it do it's thing.

 Respond  
napa182   -  Apr 21, 2010

ffs Bielie why so many damn trigger prefixes? instead of turning topic lock off "this is assuming if they have anope services on the server" you can have chanserv set it without turning the lock off if you run this on a client with the right access.

Bielie the one you made is missing a bracket. here is the one you made cleaned up a bit

on $*:text:/^!topic\b/iS:#: {
  if ($nick isop # && $2) { .cs topic # $2- }
  else { .notice $nick $iif($nick !isop #,Error: You have to be a op to use this command. $&
    ,$iif(!$2,Error: Please provide a topic Syntax: !topic Topic here)) }
}

but for something like this i would go with one that Jethro_ made

 Respond  
Cheiron   -  Apr 21, 2010

see my edited post

 Respond  
Bielie   -  Apr 21, 2010

I've taken care of that.. Look more closely at the snippet i made.

 Respond  
Cheiron   -  Apr 21, 2010

nice edit on the code there Bielie.. sorry for my last. i am in middle of advanced Excel at college atm and was shirking for a few mins.

just a couple minor edits i can see.. you can remove the noisy chanserv event and make it quiet.

/cs set $chan topiclock off

to

.cs set $chan topiclock off

then reset the topiclock after it has been set. i wont do the edit for that though as it should be straight forward

 Respond  
Bielie   -  Apr 21, 2010

I suggest using this: (Works better and always returns something.)


 on $*:text:/^[.!@]topic\b/iS:#: {
  if ($nick isop $chan) && ($address($nick,3) == $address($me) {
    .cs set $chan topiclock off
    topic $chan $2-
    return
  }

  elseif ($nick !isop $chan) && ($address($nick,3) != $address($me) {
    notice $nick Error: You have to be a op to use this command.
     return
      }

if ($2 == $null) {
notice $nick Error: Please provide a topic (Syntax: !topic (Topic)
return
}
 Respond  
Rayquaza   -  Apr 20, 2010

Okey thanks for the good advice =) I will look into it.

 Respond  
Jethro   -  Apr 20, 2010

:P WorldDMT. It was for exemplary purposes. lol

 Respond  
WorldDMT   -  Apr 20, 2010

on @:text:$($strip($1) ):#:

 Respond  
Jethro   -  Apr 20, 2010

Why $me = %botnick? I don't think it's needed unless you want your bot to be that of a certain nickname...

You only need one check for ops, rather than using two operators. An if and then else condition will do the trick.

You can do these in a couple of ways:

on *:TEXT:!topic*:#: {
  if ($nick isop $chan) {
    topic # $$2-
  }
  else {
    notice $nick You aren't an op. No topic for you.
  }
}

Or:

on *:TEXT:!topic *:#: {
  if ($nick !isop #) { 
  notice $nick You aren't an op. No topic for you. 
 }
  else { 
   topic # $2- 
  }
}

Or:

on *:TEXT:!topic *:#: { 
$iif($nick !isop #,notice $nick You aren't an op. No topic for you.,topic # $2-) 
}

I'll recommend you add a flood protection to this, in case somebody tampers with the code by way of trigger flood. For instance:

on *:TEXT:!topic*:#: {
 if (!%f) {
   inc -u5 %f
  if ($nick isop $chan) {
    topic # $$2-
  }
  else {
    notice $nick You aren't an op. No topic for you.
  }
 }
}
 Respond  
Rayquaza   -  Apr 20, 2010

Yeah, I suppose haha.

 Respond  
Cados   -  Apr 20, 2010

You do know you could just use $me for the alias also, right?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.