mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
ServiceBot: make sure all the defaultdict(set) instances are SEPARATE
Bit of a Python oddity here - If you initialize a class like defaultdict in a class constructor, the same instance is used for all instances of the class? This fixes all service bots joining the same channel, when they really shouldn't be.
This commit is contained in:
parent
7a7b590295
commit
ba53d63d37
4
utils.py
4
utils.py
@ -160,7 +160,7 @@ class ServiceBot():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name, default_help=True, default_request=False, default_list=True,
|
def __init__(self, name, default_help=True, default_request=False, default_list=True,
|
||||||
nick=None, ident=None, manipulatable=False, extra_channels=collections.defaultdict(set),
|
nick=None, ident=None, manipulatable=False, extra_channels=None,
|
||||||
desc=None):
|
desc=None):
|
||||||
# Service name
|
# Service name
|
||||||
self.name = name
|
self.name = name
|
||||||
@ -183,7 +183,7 @@ class ServiceBot():
|
|||||||
|
|
||||||
# Track what channels other than those defined in the config
|
# Track what channels other than those defined in the config
|
||||||
# that the bot should join by default.
|
# that the bot should join by default.
|
||||||
self.extra_channels = extra_channels
|
self.extra_channels = extra_channels or collections.defaultdict(set)
|
||||||
|
|
||||||
# Service description, used in the default help command if one is given.
|
# Service description, used in the default help command if one is given.
|
||||||
self.desc = desc
|
self.desc = desc
|
||||||
|
Loading…
Reference in New Issue
Block a user