mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Fixed morse code
This commit is contained in:
parent
52b1270211
commit
b8189d55ce
@ -92,7 +92,6 @@ class Moobot(callbacks.Privmsg):
|
|||||||
"7" : "--... ",
|
"7" : "--... ",
|
||||||
"8" : "---.. ",
|
"8" : "---.. ",
|
||||||
"9" : "----. ",
|
"9" : "----. ",
|
||||||
" " : " "
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_revcode = dict([(y.strip(), x) for (x, y) in _code.items()])
|
_revcode = dict([(y.strip(), x) for (x, y) in _code.items()])
|
||||||
@ -104,11 +103,14 @@ class Moobot(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
text = privmsgs.getArgs(args)
|
text = privmsgs.getArgs(args)
|
||||||
L = []
|
L = []
|
||||||
for code in text.split():
|
for (first, second, third) in window(text.split(' ')+[''], 3):
|
||||||
try:
|
if first == '' and second == '' and third == '':
|
||||||
L.append(self._revcode[code])
|
L.append(' ')
|
||||||
except KeyError:
|
else:
|
||||||
L.append(code)
|
try:
|
||||||
|
L.append(self._revcode[first])
|
||||||
|
except KeyError:
|
||||||
|
L.append(first)
|
||||||
irc.reply(msg, ''.join(L))
|
irc.reply(msg, ''.join(L))
|
||||||
|
|
||||||
def morse(self, irc, msg, args):
|
def morse(self, irc, msg, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user