give some feedback on successful commands

This commit is contained in:
Brian S. Stephan 2010-07-24 13:44:45 -05:00
parent 90df8db714
commit bad1a82dc4
1 changed files with 13 additions and 4 deletions

View File

@ -46,12 +46,17 @@ def on_privmsg(connection, event):
# join channel
if what.split(' ')[0] == 'join' and admin_unlocked:
connection.join(what.split(' ')[1])
channel = what.split(' ')[1]
connection.join(channel)
connection.privmsg(nick, 'joined ' + channel + '.')
# part channel, with message
elif what.split(' ')[0] == 'part' and admin_unlocked:
connection.part(what.split(' ')[1], ' '.join(what.split(' ')[2:]))
channel = what.split(' ')[1]
connection.part(channel, ' '.join(what.split(' ')[2:]))
connection.privmsg(nick, 'parted ' + channel + '.')
# quit server, with message
elif what.split(' ')[0] == 'quit' and admin_unlocked:
connection.privmsg(nick, 'quitting')
connection.quit(' '.join(what.split(' ')[1:]))
with open('dr.botzo.cfg', 'w') as cfg:
config.write(cfg)
@ -60,16 +65,20 @@ def on_privmsg(connection, event):
if what.split(' ')[1] == 'add':
try:
# get existing list
channel = what.split(' ')[2]
channelset = set(config.get('channels', 'autojoin').split(','))
channelset.add(what.split(' ')[2])
channelset.add(channel)
config.set('channels', 'autojoin', ','.join(channelset))
connection.privmsg(nick, 'added ' + channel + ' to autojoin')
except NoOptionError: pass
elif what.split(' ')[1] == 'remove':
try:
# get existing list
channel = what.split(' ')[2]
channelset = set(config.get('channels', 'autojoin').split(','))
channelset.discard(what.split(' ')[2])
channelset.discard(channel)
config.set('channels', 'autojoin', ','.join(channelset))
connection.privmsg(nick, 'removed ' + channel + ' from autojoin')
except NoOptionError: pass
#####