Skip to content

Commit

Permalink
Added ircbot on/off command
Browse files Browse the repository at this point in the history
  • Loading branch information
greghaynes committed Nov 14, 2009
1 parent 506e4e3 commit 750f873
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/pyscripts/IrcBot/ircbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from xsbs.events import registerServerEventHandler
from xsbs.timers import addTimer
from xsbs.colors import red, green, colordict
from xsbs.ui import info, error
from xsbs.commands import commandHandler
from UserPrivilege.userpriv import masterRequired
import asyncore, socket
import asynirc
import string
Expand Down Expand Up @@ -59,6 +62,18 @@ def handle_privmsg(self, who, to, message):
if enable:
bot.doConnect()

@commandHandler('ircbot')
@masterRequired
def ircbotCmd(cn, args):
if args == 'off':
bot.close()
sbserver.playerMessage(cn, info('Irc bot enabled'))
elif args == 'on':
bot.doConnect()
sbserver.playerMessage(cn, info('Irc bot disabled'))
else:
sbserver.playerMessage(cn, error('Usage: #ircbot off/on'))

def onPlayerConnect(cn):
bot.message('\x032CONNECT \x03Player %s (%i) has joined' % (sbserver.playerName(cn), cn), channel)

Expand Down

0 comments on commit 750f873

Please sign in to comment.