Skip to content

Commit

Permalink
[core] Fix NameError and simplify code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-koivula committed Aug 29, 2013
1 parent 4e658a9 commit 89e5233
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions willie/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,9 @@ def list_ops(bot, trigger):
List channel operators in the given channel, or current channel if none is
given.
"""
if trigger.group(2):
bot.say(trigger.group(2))
if trigger.group(2) in bot.ops:
bot.say(str(bot.ops[channel]))
else:
bot.say('None')
else:
if trigger.sender in bot.ops:
bot.say(str(bot.ops[trigger.sender]))
else:
bot.say('None')
channel = trigger.group(2) if trigger.group(2) else trigger.sender
user_list = str(bot.ops.get(channel))
bot.say(user_list)


@willie.module.commands('listvoices')
Expand All @@ -117,17 +109,9 @@ def list_voices(bot, trigger):
List users with voice in the given channel, or current channel if none is
given.
"""
if trigger.group(2):
bot.say(trigger.group(2))
if trigger.group(2) in bot.voices:
bot.say(str(bot.voices[channel]))
else:
bot.say('None')
else:
if trigger.sender in bot.voices:
bot.say(str(bot.voices[trigger.sender]))
else:
bot.say('None')
channel = trigger.group(2) if trigger.group(2) else trigger.sender
user_list = str(bot.voices.get(channel))
bot.say(user_list)


@willie.module.rule('(.*)')
Expand Down

0 comments on commit 89e5233

Please sign in to comment.