Skip to content

Commit

Permalink
[various modules] Use @commands rather than @command
Browse files Browse the repository at this point in the history
Issue #276
  • Loading branch information
embolalia committed Jun 24, 2013
1 parent 5911794 commit 451bb52
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion willie/modules/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def set_config(bot, trigger):
setattr(getattr(bot.config, section), option, value)


@willie.module.command('save')
@willie.module.commands('save')
@willie.module.example('.save')
def save_config(bot, trigger):
"""Save state of willies config object to the configuration file."""
Expand Down
28 changes: 14 additions & 14 deletions willie/modules/adminchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

import re
from willie.module import command, commands, priority
from willie.module import commands, priority


def setup(bot):
Expand All @@ -19,7 +19,7 @@ def setup(bot):
bot.db.preferences.add_columns(['topic_mask'])


@command('op')
@commands('op')
def op(bot, trigger):
"""
Command to op users in a room. If no nick is given,
Expand All @@ -33,7 +33,7 @@ def op(bot, trigger):
bot.write(['MODE', channel, "+o", nick])


@command('deop')
@commands('deop')
def deop(bot, trigger):
"""
Command to deop users in a room. If no nick is given,
Expand All @@ -47,7 +47,7 @@ def deop(bot, trigger):
bot.write(['MODE', channel, "-o", nick])


@command('voice')
@commands('voice')
def voice(bot, trigger):
"""
Command to voice users in a room. If no nick is given,
Expand All @@ -61,7 +61,7 @@ def voice(bot, trigger):
bot.write(['MODE', channel, "+v", nick])


@command('devoice')
@commands('devoice')
def devoice(bot, trigger):
"""
Command to devoice users in a room. If no nick is given,
Expand All @@ -75,7 +75,7 @@ def devoice(bot, trigger):
bot.write(['MODE', channel, "-v", nick])


@command('kick')
@commands('kick')
@priority('high')
def kick(bot, trigger):
"""
Expand Down Expand Up @@ -124,7 +124,7 @@ def configureHostMask(mask):
return ''


@command('ban')
@commands('ban')
@priority('high')
def ban(bot, trigger):
"""
Expand All @@ -151,7 +151,7 @@ def ban(bot, trigger):
bot.write(['MODE', channel, '+b', banmask])


@command('unban')
@commands('unban')
def unban(bot, trigger):
"""
This give admins the ability to unban a user.
Expand All @@ -177,7 +177,7 @@ def unban(bot, trigger):
bot.write(['MODE', channel, '-b', banmask])


@command('quiet')
@commands('quiet')
def quiet(bot, trigger):
"""
This gives admins the ability to quiet a user.
Expand All @@ -203,7 +203,7 @@ def quiet(bot, trigger):
bot.write(['MODE', channel, '+q', quietmask])


@command('unquiet')
@commands('unquiet')
def unquiet(bot, trigger):
"""
This gives admins the ability to unquiet a user.
Expand Down Expand Up @@ -262,7 +262,7 @@ def kickban(bot, trigger):
bot.write(['KICK', channel, nick, ' :', reason])


@command('topic')
@commands('topic')
def topic(bot, trigger):
"""
This gives ops the ability to change the topic.
Expand Down Expand Up @@ -297,7 +297,7 @@ def topic(bot, trigger):
bot.write(('TOPIC', channel + ' :' + topic))


@command('tmask')
@commands('tmask')
def set_mask(bot, trigger):
"""
Set the mask to use for .topic in the current channel. %s is used to allow
Expand All @@ -312,7 +312,7 @@ def set_mask(bot, trigger):
bot.say("Gotcha, " + trigger.nick)


@command('showmask')
@commands('showmask')
def show_mask(bot, trigger):
"""Show the topic mask for the current channel."""
if not trigger.isop:
Expand All @@ -325,7 +325,7 @@ def show_mask(bot, trigger):
bot.say("%s")


@command('isop')
@commands('isop')
def isop(bot, trigger):
"""Show if you are an operator in the current channel"""
if trigger.isop:
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/announce.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
Licensed under the Eiffel Forum License 2.
"""
from willie.module import command, example
from willie.module import commands, example


@command('announce')
@commands('announce')
@example('.announce Some important message here')
def announce(bot, trigger):
"""
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import re
from willie import web
from willie.module import command, commands, example
from willie.module import commands, example
from socket import timeout
import string
import HTMLParser
Expand Down Expand Up @@ -46,7 +46,7 @@ def c(bot, trigger):
bot.reply(result)


@command('py')
@commands('py')
@example('.py len([1,2,3])')
def py(bot, trigger):
"""Evaluate a Python expression."""
Expand Down
6 changes: 3 additions & 3 deletions willie/modules/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""
import pytz
import datetime
from willie.module import commands, command, example
from willie.module import commands, example


def setup(bot):
Expand Down Expand Up @@ -61,7 +61,7 @@ def f_time(bot, trigger):
bot.say(now.strftime(tformat or "%F - %T%Z"))


@command('settz')
@commands('settz')
@example('.settz America/New_York')
def update_user(bot, trigger):
"""
Expand Down Expand Up @@ -125,7 +125,7 @@ def update_user_format(bot, trigger):
bot.reply("I can't remember that; I don't have a database.")


@command('channeltz')
@commands('channeltz')
@example('.chantz America/New_York')
def update_channel(bot, trigger):
"""
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/countdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
http://willie.dfbta.net
"""
from willie.module import command, NOLIMIT
from willie.module import commands, NOLIMIT
import datetime


@command('countdown')
@commands('countdown')
def generic_countdown(bot, trigger):
"""
.countdown <year> <month> <day> - displays a countdown to a given date.
Expand Down
12 changes: 6 additions & 6 deletions willie/modules/dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
seed()


@willie.module.command("roll")
@willie.module.command("dice")
@willie.module.command("d")
@willie.module.commands("roll")
@willie.module.commands("dice")
@willie.module.commands("d")
@willie.module.priority("medium")
def dice(bot, trigger):
"""
Expand Down Expand Up @@ -95,9 +95,9 @@ def rollDice(diceroll):
return sorted(result) # returns a set of integers.


@willie.module.command("choice")
@willie.module.command("ch")
@willie.module.command("choose")
@willie.module.commands("choice")
@willie.module.commands("ch")
@willie.module.commands("choose")
@willie.module.priority("medium")
def choose(bot, trigger):
"""
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/etymology.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import re
from willie import web
from willie.module import command, example, NOLIMIT
from willie.module import commands, example, NOLIMIT

etyuri = 'http://etymonline.com/?term=%s'
etysearch = 'http://etymonline.com/?search=%s'
Expand Down Expand Up @@ -71,7 +71,7 @@ def etymology(word):
return sentence + ' - ' + (etyuri % word)


@command('ety')
@commands('ety')
@example('word')
def f_etymology(bot, trigger):
"""Look up the etymology of a word"""
Expand Down
6 changes: 3 additions & 3 deletions willie/modules/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
http://willie.dftba.net
"""
from willie.module import command, rule, example, priority
from willie.module import commands, rule, example, priority


@rule('$nick' '(?i)(help|doc) +([A-Za-z]+)(?:\?+)?$')
@example('.help tell')
@command('help')
@commands('help')
@priority('low')
def help(bot, trigger):
"""Shows a command's documentation, and possibly an example."""
Expand All @@ -27,7 +27,7 @@ def help(bot, trigger):
bot.say('e.g. ' + bot.doc[name][1])


@command('commands')
@commands('commands')
@priority('low')
def commands(bot, trigger):
"""Return a list of bot's commands"""
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from time import sleep
from xml.dom.minidom import parseString
import willie.web as web
from willie.module import command
from willie.module import commands
import xml.dom.minidom


Expand Down Expand Up @@ -84,7 +84,7 @@ def nextSong(bot, trigger):
bot.say('No songs are queued up.')


@command('radio')
@commands('radio')
def radio(bot, trigger):
""" Radio functions, valid parameters: on, off, song, now, next, soon, stats. """
global checkSongs, current_song, radioURL
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/reddit-info.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
This module provides special tools for reddit, namely showing detailed info about reddit posts
"""

from willie.module import command, rule, example, NOLIMIT
from willie.module import commands, rule, example, NOLIMIT
import praw
import re
domain = r'https?://(?:www\.|np\.)?reddit\.com'
Expand Down Expand Up @@ -45,7 +45,7 @@ def rpost_info(bot, trigger, match=None):


#If you change this, you'll have to change some other things...
@command('redditor')
@commands('redditor')
def redditor_info(bot, trigger, match=None):
"""Show information about the given Redditor"""
commanded = re.match(bot.config.prefix + 'redditor', trigger)
Expand Down
6 changes: 3 additions & 3 deletions willie/modules/remind.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import pytz
import codecs
from datetime import tzinfo, timedelta, datetime
from willie.module import command, example, NOLIMIT
from willie.module import commands, example, NOLIMIT


def filename(self):
Expand Down Expand Up @@ -120,7 +120,7 @@ def monitor(bot):
periods = '|'.join(scaling.keys())


@command('in')
@commands('in')
@example('.in 3h45m Go to class')
def remind(bot, trigger):
"""Gives you a reminder in the given amount of time."""
Expand Down Expand Up @@ -151,7 +151,7 @@ def remind(bot, trigger):
create_reminder(bot, trigger, duration, reminder, tzi)


@command('at')
@commands('at')
@example('.at 13:47 Do your homework!')
def at(bot, trigger):
"""
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/seen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import datetime
import pytz
from willie.tools import Ddict, Nick
from willie.module import command, rule, priority
from willie.module import commands, rule, priority

seen_dict = Ddict(dict)

Expand All @@ -28,7 +28,7 @@ def get_user_time(bot, nick):
return (pytz.timezone(tz.strip()), tformat or '%Y-%m-%d %H:%M:%S %Z')


@command('seen')
@commands('seen')
def seen(bot, trigger):
"""Reports when and where the user was last seen."""
if not trigger.group(2):
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/unicode_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
http://willie.dfbta.net
"""
import unicodedata
from willie.module import command, example, NOLIMIT
from willie.module import commands, example, NOLIMIT


@command('u')
@commands('u')
@example('.u 203D')
def codepoint(bot, trigger):
arg = trigger.group(2).strip()
Expand Down
4 changes: 2 additions & 2 deletions willie/modules/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Licensed under the Eiffel Forum License 2.
"""
from willie.module import command, commands, example, NOLIMIT
from willie.module import commands, example, NOLIMIT
import re

find_temp = re.compile('(-?[0-9]*\.?[0-9]*)[ °]*(K|C|F)', re.IGNORECASE)
Expand All @@ -29,7 +29,7 @@ def k_to_c(temp):
return temp - 273.15


@command('temp')
@commands('temp')
@example('.temp 100F')
def temperature(bot, trigger):
"""
Expand Down
Loading

0 comments on commit 451bb52

Please sign in to comment.