give some feedback on successful commands
This commit is contained in:
parent
90df8db714
commit
bad1a82dc4
17
dr.botzo.py
17
dr.botzo.py
@ -46,12 +46,17 @@ def on_privmsg(connection, event):
|
|||||||
|
|
||||||
# join channel
|
# join channel
|
||||||
if what.split(' ')[0] == 'join' and admin_unlocked:
|
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
|
# part channel, with message
|
||||||
elif what.split(' ')[0] == 'part' and admin_unlocked:
|
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
|
# quit server, with message
|
||||||
elif what.split(' ')[0] == 'quit' and admin_unlocked:
|
elif what.split(' ')[0] == 'quit' and admin_unlocked:
|
||||||
|
connection.privmsg(nick, 'quitting')
|
||||||
connection.quit(' '.join(what.split(' ')[1:]))
|
connection.quit(' '.join(what.split(' ')[1:]))
|
||||||
with open('dr.botzo.cfg', 'w') as cfg:
|
with open('dr.botzo.cfg', 'w') as cfg:
|
||||||
config.write(cfg)
|
config.write(cfg)
|
||||||
@ -60,16 +65,20 @@ def on_privmsg(connection, event):
|
|||||||
if what.split(' ')[1] == 'add':
|
if what.split(' ')[1] == 'add':
|
||||||
try:
|
try:
|
||||||
# get existing list
|
# get existing list
|
||||||
|
channel = what.split(' ')[2]
|
||||||
channelset = set(config.get('channels', 'autojoin').split(','))
|
channelset = set(config.get('channels', 'autojoin').split(','))
|
||||||
channelset.add(what.split(' ')[2])
|
channelset.add(channel)
|
||||||
config.set('channels', 'autojoin', ','.join(channelset))
|
config.set('channels', 'autojoin', ','.join(channelset))
|
||||||
|
connection.privmsg(nick, 'added ' + channel + ' to autojoin')
|
||||||
except NoOptionError: pass
|
except NoOptionError: pass
|
||||||
elif what.split(' ')[1] == 'remove':
|
elif what.split(' ')[1] == 'remove':
|
||||||
try:
|
try:
|
||||||
# get existing list
|
# get existing list
|
||||||
|
channel = what.split(' ')[2]
|
||||||
channelset = set(config.get('channels', 'autojoin').split(','))
|
channelset = set(config.get('channels', 'autojoin').split(','))
|
||||||
channelset.discard(what.split(' ')[2])
|
channelset.discard(channel)
|
||||||
config.set('channels', 'autojoin', ','.join(channelset))
|
config.set('channels', 'autojoin', ','.join(channelset))
|
||||||
|
connection.privmsg(nick, 'removed ' + channel + ' from autojoin')
|
||||||
except NoOptionError: pass
|
except NoOptionError: pass
|
||||||
|
|
||||||
#####
|
#####
|
||||||
|
Loading…
Reference in New Issue
Block a user