Mode And Moderation For Bots

By MaxEvans on Mar 25, 2009

I wrote this for my bot to change the channel modes easily. I also put in a moderation trigger as well. It's probably not very good, but it can be useful if you don't want to type the full mode command out. Plus, it lets you change modes without being an op. As long as your bot has op status.

Usage:

Load the script, then set admin and channel via the commands menu.

Triggers are as follows:

!admin [Nick] (Adds a nick to the admin list)

!deladmin [Nick] (Removes a nick from the admin list)

!mode [-/+mode] (the mode you wish to change, ex: +S, -S, +U, etc.)

!mod (Moderates the channel and sends a message saying so)

!unmod (Unmoderates the channel and sends a message saying so)

on *:load:{
  if ($version > 6.30) { echo -a 15,2The Mode and Moderation Bot by 2,7Max Evans15,2 was successfully loaded. | echo -a 15,2Check the menubar for owner and channel set options. }
  else { echo -a 8,1Sorry. This addon requires the latest version of mIRC. Please download it from www.mirc.com | .unload -rs " $+ $script $+ " } 
}

on *:text:!admin *:#:{
  if ($nick == %mbotowner) { writeini mbotadmins.ini $chan $2 mbotadmin | notice $nick Added $2 To Admin List }
  else { notice $nick Command Ignored (Must Be Owner) }
}

on *:text:!deladmin *:#:{
  if ($nick == %mbotowner) { remini mbotadmins.ini $chan $2 mbotadmin | notice $nick Deleted $2 From Admin List }
  else { notice $nick Command Ignored (Must Be Owner) }
}

on *:text:!mode *:%mbotchan: {
  if ($readini(mbotadmins.ini,$chan,$nick) == mbotadmin) {
    mode $chan $2-
  }
  else {
    .notice $nick Sorry, only admins can use this feature.
  }
}

on *:text:!mod:%mbotchan: {
  if ($readini(mbotadmins.ini,$chan,$nick) == mbotadmin) {
    mode $chan +m
    .msg $chan Room is now being moderated. Only voiced (+v) users can chat.
  }
  else {
    .notice $nick Sorry, only admins can use this feature.
  }
}
on *:text:!unmod:%mbotchan: {
  if ($readini(mbotadmins.ini,$chan,$nick) == mbotadmin) {
    mode $chan -m
    .msg $chan Room is no longer being moderated. All users can now chat.
  }
  else {
    .notice $nick Sorry, only admins can use this feature.
  }
}

menu * {
  .Mod Bot set up
  ..Set Mod Bot Owner: { set %mbotowner $?="What Nick Would You Like As Mod Bot Owner?" | echo -a Mod Bot Owner Is Now Set As %mbotowner }
  ..Set Mod Bot Channel: { set %mbotchan $?="What Channel Would You Like Set For Mod Bot?" | echo -a Mod Bot Channel Is Now Set As %mbotchan }
}

Comments

Sign in to comment.
MaxEvans   -  May 09, 2009

Try that. I fixed it.

 Respond  
palawanisland   -  May 09, 2009

error : if ($version > 6.35)

script does not work..

 Respond  
MaxEvans   -  Mar 26, 2009

There, I changed it to %mbotowner since it still uses the variable to write the ini. That way only one person can add admins.

 Respond  
Kirby   -  Mar 26, 2009

Looks good.

But because you've implemented multi-admin adding (through the bot trigger), you're going to have to change the menu portion because you no longer use %mbotadmin, or just discard it.

 Respond  
MaxEvans   -  Mar 26, 2009

Added multi admin support via ini file. Triggers for adding and deleting admins are in the introduction above the code. =] Let me know if there's any problems.

 Respond  
Kirby   -  Mar 25, 2009

Also, the last menu portion echoes

Mod Bot Channel Is Now Set As mbotchan

, which should be

Mod Bot Channel Is Now Set As %mbotchan
 Respond  
MaxEvans   -  Mar 25, 2009

I always miss that last bracket. I gotta remember it. But, I'll add multi admin to it in a little bit.

 Respond  
Aucun50   -  Mar 25, 2009

Was going to say about the bracket but Kirby beat me to it again :(

Looks ok

 Respond  
Kirby   -  Mar 25, 2009

You're missing a bracket at the end. :p
Because this all takes place under %mbotchan, I recommend you put it all under one text file, and I think you can make the last two text events much shorter.
And yes, I concur with Zaff, adding multiple administrators (use .ini files?) will be nice.

 Respond  
MaxEvans   -  Mar 25, 2009

I was going to do that as well. As soon as I get it, I'll update it on here.

 Respond  
Zaff   -  Mar 25, 2009

Its alright, May I suggest adding mutli Administrators to the bot?

4/10

 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.