From: Ian Jackson Date: Thu, 30 May 2019 10:08:23 +0000 (+0100) Subject: FishPond: introduce new class and use in Servus-chiark X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=6606843b86656d0c7f01b36009feedd4421eb2d2;hp=5ccd4c4d57f2640277e831fbfd62b5e5d6a40c23;p=irc.git 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 --- 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: