Undoing CID whitelist hypercorrection (and changing name to a more self-explanatory one)

This commit is contained in:
vylion 2020-10-27 19:49:46 +01:00
parent c91ceda24b
commit a13bdd51c7
2 changed files with 5 additions and 5 deletions

View file

@ -45,7 +45,7 @@ class Speaker(object):
def __init__(self, username, archivist, logger, admin=0, nicknames=[],
reply=0.1, repeat=0.05, wakeup=False, mode=ModeFixed,
memory=20, mute_time=60, save_time=3600, bypass=False,
filter_cids=[], max_len=50
cid_whitelist=None, max_len=50
):
self.names = nicknames
self.mute_time = mute_time
@ -66,7 +66,7 @@ class Speaker(object):
self.logger = logger
self.reply = reply
self.repeat = repeat
self.filter_cids = filter_cids
self.cid_whitelist = cid_whitelist
self.memory = MemoryList(memory)
self.save_time = save_time
self.memory_timer = int(time.perf_counter())
@ -219,7 +219,7 @@ class Speaker(object):
def say(self, bot, reader, replying=None, **kwargs):
cid = reader.cid()
if cid not in self.filter_cids:
if self.cid_whitelist is not None and cid not in self.cid_whitelist:
return
if self.is_mute():
return

View file

@ -79,7 +79,7 @@ def main():
help='The ID of the Telegram user that manages this bot')
parser.add_argument('-w', '--wakeup', action='store_true',
help='Flag that makes the bot send a first message to all chats during wake up.')
parser.add_argument('-f', '--filter', nargs='*', default=[], metavar='cid',
parser.add_argument('-f', '--filter', nargs='*', default=None, metavar='cid',
help='Zero or more chat IDs to add in a filter whitelist (default is empty, all chats allowed)')
parser.add_argument('-n', '--nicknames', nargs='*', default=[], metavar='name',
help='Any possible nicknames that the bot could answer to.')
@ -112,7 +112,7 @@ def main():
archivist,
logger,
admin=args.admin_id,
filter_cids=filter_cids,
cid_whitelist=filter_cids,
nicknames=args.nicknames,
wakeup=args.wakeup,
memory=args.capacity,