mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
Irc: allow defaulting to private command replies (Closes #409)
Squashed commit of the following: commit c168500235b65f833b1d7fe49ebde674159683ee Author: James Lu <GLolol@overdrivenetworks.com> Date: Thu Feb 16 17:33:36 2017 -0800 ServiceBot: default notice and private to None This is so that it respects the changes from the last commit. commit f685f3ef522f7f0ee356082c3c1b8b5a4e34b211 Author: James Lu <GLolol@overdrivenetworks.com> Date: Thu Feb 16 15:10:33 2017 -0800 Irc: implement a prefer_private_replies option (#409)
This commit is contained in:
parent
ad873cfd7b
commit
2f968aca80
@ -524,6 +524,10 @@ class Irc():
|
||||
loopback=True):
|
||||
"""Replies to the last caller in the right context (channel or PM)."""
|
||||
|
||||
if private is None:
|
||||
# Allow using private replies as the default, if no explicit setting was given.
|
||||
private = conf.conf['bot'].get("prefer_private_replies")
|
||||
|
||||
# Private reply is enabled, or the caller was originally a PM
|
||||
if private or (self.called_in in self.users):
|
||||
if not force_privmsg_in_private:
|
||||
|
@ -45,6 +45,10 @@ bot:
|
||||
# of all database-enabled plugins to take effect.
|
||||
save_delay: 300
|
||||
|
||||
# Determines whether services should default to sending command responses as private notices,
|
||||
# even if the command was called in a channel. This defaults to False.
|
||||
#prefer_private_replies: false
|
||||
|
||||
login:
|
||||
# NOTE: for users migrating from PyLink < 1.1, the old login:user/login:password settings
|
||||
# have been deprecated. We strongly recommend migrating to the new "accounts:" block below, as
|
||||
|
4
utils.py
4
utils.py
@ -284,7 +284,7 @@ class ServiceBot():
|
||||
else:
|
||||
log.warning('(%s) Ignoring invalid autojoin channel %r.', irc.name, chan)
|
||||
|
||||
def reply(self, irc, text, notice=False, private=False):
|
||||
def reply(self, irc, text, notice=None, private=None):
|
||||
"""Replies to a message as the service in question."""
|
||||
servuid = self.uids.get(irc.name)
|
||||
if not servuid:
|
||||
@ -293,7 +293,7 @@ class ServiceBot():
|
||||
|
||||
irc.reply(text, notice=notice, source=servuid, private=private)
|
||||
|
||||
def error(self, irc, text, notice=False, private=False):
|
||||
def error(self, irc, text, notice=None, private=None):
|
||||
"""Replies with an error, as the service in question."""
|
||||
servuid = self.uids.get(irc.name)
|
||||
if not servuid:
|
||||
|
Loading…
Reference in New Issue
Block a user