Skip to content

Commit

Permalink
coretasks: Replace numeric events with their enums
Browse files Browse the repository at this point in the history
Also add the missing RPL_WHOSPCRPL to tools.events
  • Loading branch information
embolalia committed Dec 20, 2015
1 parent ade8419 commit 8bbc9d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions sopel/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import sopel
import sopel.module
from sopel.bot import _CapReq
from sopel.tools import Identifier, iteritems
from sopel.tools import Identifier, iteritems, events
from sopel.tools.target import User, Channel
import base64
from sopel.logger import get_logger
Expand Down Expand Up @@ -55,7 +55,7 @@ def auth_after_register(bot):
))


@sopel.module.event('001', '251')
@sopel.module.event(events.RPL_WELCOME, events.RPL_LUSERCLIENT)
@sopel.module.rule('.*')
@sopel.module.thread(False)
@sopel.module.unblockable
Expand Down Expand Up @@ -95,7 +95,7 @@ def startup(bot, trigger):
bot.join(channel)


@sopel.module.event('477')
@sopel.module.event(events.ERR_NOCHANMODES)
@sopel.module.rule('.*')
@sopel.module.priority('high')
def retry_join(bot, trigger):
Expand All @@ -121,7 +121,7 @@ def retry_join(bot, trigger):


@sopel.module.rule('(.*)')
@sopel.module.event('353')
@sopel.module.event(events.RPL_NAMREPLY)
@sopel.module.priority('high')
@sopel.module.thread(False)
@sopel.module.unblockable
Expand Down Expand Up @@ -494,7 +494,7 @@ def auth_proceed(bot, trigger):
bot.write(('AUTHENTICATE', base64.b64encode(sasl_token.encode('utf-8'))))


@sopel.module.event('903')
@sopel.module.event(events.RPL_SASLSUCCESS)
@sopel.module.rule('.*')
def sasl_success(bot, trigger):
bot.write(('CAP', 'END'))
Expand Down Expand Up @@ -599,7 +599,7 @@ def account_notify(bot, trigger):
bot.users[trigger.nick].account = account


@sopel.module.event('354')
@sopel.module.event(events.RPL_WHOSPCRPL)
@sopel.module.rule('.*')
@sopel.module.priority('high')
@sopel.module.unblockable
Expand Down Expand Up @@ -630,7 +630,7 @@ def _record_who(bot, channel, user, host, nick, account=None, away=None):
bot.channels[channel].add_user(user)


@sopel.module.event('352')
@sopel.module.event(events.RPL_WHOREPLY)
@sopel.module.rule('.*')
@sopel.module.priority('high')
@sopel.module.unblockable
Expand All @@ -639,7 +639,7 @@ def recv_who(bot, trigger):
_record_who(bot, channel, user, host, nick)


@sopel.module.event('315')
@sopel.module.event(events.RPL_ENDOFWHO)
@sopel.module.rule('.*')
@sopel.module.priority('high')
@sopel.module.unblockable
Expand Down
3 changes: 2 additions & 1 deletion sopel/modules/find_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import sopel
import sopel.module
import sopel.web
import sopel.tools

wait_time = 24 * 60 * 60 # check once per day
startup_check_run = False
Expand All @@ -29,7 +30,7 @@
)


@sopel.module.event('251')
@sopel.module.event(sopel.tools.events.LUSERCLIENT)

This comment has been minimized.

Copy link
@elad661

elad661 Dec 20, 2015

Contributor

should be events.LUSERCLIENT, without sopel.tools.

@sopel.module.rule('.*')
def startup_version_check(bot, trigger):
global startup_check_run
Expand Down
1 change: 1 addition & 0 deletions sopel/tools/_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class events(object):
# Only add things here if they're actually in common use across multiple
# ircds.
RPL_ISUPPORT = '005'
RPL_WHOSPCRPL = '354'

# ################################################################### IRC v3
# ## 3.1
Expand Down

0 comments on commit 8bbc9d0

Please sign in to comment.