Replace IRCException by IMException, as nemubot is not only built for IRC

This commit is contained in:
nemunaire 2015-10-30 21:57:45 +01:00
parent ac33ceb579
commit 8b4f08c5bd
40 changed files with 183 additions and 188 deletions

View file

@ -5,7 +5,7 @@
import re
from nemubot import context
from nemubot.exception import IRCException
from nemubot.exception import IMException
from nemubot.hooks import hook
from nemubot.tools import web
@ -61,7 +61,7 @@ def print_station_status(msg, station):
return Response("À la station %s : %d vélib et %d points d'attache"
" disponibles." % (station, available, free),
channel=msg.channel)
raise IRCException("station %s inconnue." % station)
raise IMException("station %s inconnue." % station)
# MODULE INTERFACE ####################################################
@ -73,9 +73,9 @@ def print_station_status(msg, station):
})
def ask_stations(msg):
if len(msg.args) > 4:
raise IRCException("demande-moi moins de stations à la fois.")
raise IMException("demande-moi moins de stations à la fois.")
elif not len(msg.args):
raise IRCException("pour quelle station ?")
raise IMException("pour quelle station ?")
for station in msg.args:
if re.match("^[0-9]{4,5}$", station):
@ -84,4 +84,4 @@ def ask_stations(msg):
return print_station_status(msg,
context.data.index[station]["number"])
else:
raise IRCException("numéro de station invalide.")
raise IMException("numéro de station invalide.")