mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 14:49:28 +01:00
ServiceBot.call_cmd: support notice and called_by keys
This commit is contained in:
parent
ae87def11f
commit
2877d7af4c
12
utils.py
12
utils.py
@ -188,21 +188,25 @@ class ServiceBot():
|
|||||||
else:
|
else:
|
||||||
raise NotImplementedError("Network specific plugins not supported yet.")
|
raise NotImplementedError("Network specific plugins not supported yet.")
|
||||||
|
|
||||||
def reply(self, irc, text, notice=True):
|
def reply(self, irc, text):
|
||||||
"""Replies to a message using the right service UID."""
|
"""Replies to a message using the right service UID."""
|
||||||
servuid = self.uids.get(irc.name)
|
servuid = self.uids.get(irc.name)
|
||||||
if not servuid:
|
if not servuid:
|
||||||
log.warning("(%s) Possible desync? UID for service %s doesn't exist!", irc.name, self.name)
|
log.warning("(%s) Possible desync? UID for service %s doesn't exist!", irc.name, self.name)
|
||||||
return
|
return
|
||||||
|
|
||||||
irc.reply(text, notice=notice, source=servuid)
|
irc.reply(text, notice=self.use_notice, source=servuid)
|
||||||
|
|
||||||
def call_cmd(self, irc, source, text):
|
def call_cmd(self, irc, source, text, called_by=None, notice=True):
|
||||||
"""
|
"""
|
||||||
Calls a PyLink bot command. source is the caller's UID, and text is the
|
Calls a PyLink bot command. source is the caller's UID, and text is the
|
||||||
full, unparsed text of the message.
|
full, unparsed text of the message.
|
||||||
"""
|
"""
|
||||||
irc.called_by = source
|
irc.called_by = called_by or source
|
||||||
|
|
||||||
|
# Store this globally so other commands don't have to worry about whether
|
||||||
|
# we're preferring notices.
|
||||||
|
self.use_notice = notice
|
||||||
|
|
||||||
cmd_args = text.strip().split(' ')
|
cmd_args = text.strip().split(' ')
|
||||||
cmd = cmd_args[0].lower()
|
cmd = cmd_args[0].lower()
|
||||||
|
Loading…
Reference in New Issue
Block a user