From be6fe2eb8e3d86449f71882803cede8742d0af58 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sat, 8 Jun 2019 13:55:36 -0400 Subject: [PATCH] test --- sopel_modules/SpiceBot/Channels.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sopel_modules/SpiceBot/Channels.py b/sopel_modules/SpiceBot/Channels.py index 7692181..36faa2f 100644 --- a/sopel_modules/SpiceBot/Channels.py +++ b/sopel_modules/SpiceBot/Channels.py @@ -33,6 +33,14 @@ class BotChannels(): "InitialProcess": False } + def __getattr__(self, name): + ''' will only get called for undefined attributes ''' + """We will try to find a dict value, or return None""" + if name.lower() in list(self.dict.keys()): + return self.dict[str(name).lower()] + else: + raise Exception('Channel dict does not contain a function or key ' + str(name.lower())) + def setup_channels(self): botconfig.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)