From 6606843b86656d0c7f01b36009feedd4421eb2d2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 30 May 2019 11:08:23 +0100 Subject: [PATCH] FishPond: introduce new class and use in Servus-chiark The configuration class `fish' appears in every bot, but it also contains initial values of state variables used by the implementation. Move those into their own class, and make it a base class of Servus-chiark's pond. Since we are duck typing, it is OK to not yet update the other bots. Signed-off-by: Ian Jackson --- Servus-chiark.py | 6 +----- commands.py | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Servus-chiark.py b/Servus-chiark.py index 6d3af24..45b19a4 100755 --- a/Servus-chiark.py +++ b/Servus-chiark.py @@ -42,17 +42,13 @@ import commands as c # This fishpond is shared between trouts and flirts. It doesn't have to be; # you can define as many ponds as you like. -class fish: +class fish (c.FishPond): cur_fish=5 max_fish=5 nofish_time=60 fish_time_inc=60 fish_inc=2 - DoS=0 Boring_Git='Nobody' - quotatime=0 - last="" - last_cfg=None # load the "blame" details for a file def loadblame(filename): diff --git a/commands.py b/commands.py index 964dacf..6c5653d 100755 --- a/commands.py +++ b/commands.py @@ -53,6 +53,12 @@ def infoq(bot, cmd, nick, conn, public, karma): (bot.revision.split()[1], bot.channel, conn.get_nickname(), bot.owner, len(karma.keys()))) +class FishPond: + DoS=0 + quotatime=0 + last="" + last_cfg=None + # Check on fish stocks def fish_quota(pond): if pond.DoS: -- 2.30.2