parent
0c3e4e08ee
commit
311457148e
|
@ -25,7 +25,7 @@ class Message:
|
||||||
if text:
|
if text:
|
||||||
self.text = text
|
self.text = text
|
||||||
if not (cmd or text):
|
if not (cmd or text):
|
||||||
print('Please pass Message a command or text!')
|
raise TypeError('missing cmd or text parameter')
|
||||||
|
|
||||||
|
|
||||||
class Bot(irc.bot.SingleServerIRCBot):
|
class Bot(irc.bot.SingleServerIRCBot):
|
||||||
|
@ -127,6 +127,9 @@ class Bot(irc.bot.SingleServerIRCBot):
|
||||||
def on_privmsg(self, c, e):
|
def on_privmsg(self, c, e):
|
||||||
self.process_command(c, e)
|
self.process_command(c, e)
|
||||||
|
|
||||||
|
def on_action(self, c, e):
|
||||||
|
self.process_command(c, e)
|
||||||
|
|
||||||
def process_command(self, c, e):
|
def process_command(self, c, e):
|
||||||
nick = e.source.nick
|
nick = e.source.nick
|
||||||
text = e.arguments[0]
|
text = e.arguments[0]
|
||||||
|
@ -134,6 +137,9 @@ class Bot(irc.bot.SingleServerIRCBot):
|
||||||
chan = nick
|
chan = nick
|
||||||
else:
|
else:
|
||||||
chan = e.target
|
chan = e.target
|
||||||
|
if e.type == 'action':
|
||||||
|
cmd = ''
|
||||||
|
else:
|
||||||
cmd = text.split(' ')[0]
|
cmd = text.split(' ')[0]
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
'Message info: channel: {}, nick: {}, cmd: {}, text: {}'.format(chan, nick, cmd, text)
|
'Message info: channel: {}, nick: {}, cmd: {}, text: {}'.format(chan, nick, cmd, text)
|
||||||
|
|
Loading…
Reference in New Issue