diff options
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/stats.py | 17 | 
1 files changed, 16 insertions, 1 deletions
| diff --git a/bot/cogs/stats.py b/bot/cogs/stats.py index d253db913..acee1f5a9 100644 --- a/bot/cogs/stats.py +++ b/bot/cogs/stats.py @@ -2,8 +2,10 @@ import string  from datetime import datetime  from discord import Member, Message, Status -from discord.ext.commands import Bot, Cog, Context +from discord.ext.commands import Cog, Context +from discord.ext.tasks import loop +from bot.bot import Bot  from bot.constants import Channels, Guild, Stats as StatConf @@ -23,6 +25,7 @@ class Stats(Cog):      def __init__(self, bot: Bot):          self.bot = bot          self.last_presence_update = None +        self.update_guild_boost.start()      @Cog.listener()      async def on_message(self, message: Message) -> None: @@ -101,6 +104,18 @@ class Stats(Cog):          self.bot.stats.gauge("guild.status.do_not_disturb", dnd)          self.bot.stats.gauge("guild.status.offline", offline) +    @loop(hours=1) +    async def update_guild_boost(self) -> None: +        """Update every hour guild boosts amount + level.""" +        await self.bot.wait_until_guild_available() +        g = self.bot.get_guild(Guild.id) +        self.bot.stats.gauge("boost.amount", g.premium_subscription_count) +        self.bot.stats.gauge("boost.tier", g.premium_tier) + +    def cog_unload(self) -> None: +        """Stop guild boost stat collecting task on Cog unload.""" +        self.update_guild_boost.stop() +  def setup(bot: Bot) -> None:      """Load the stats cog.""" | 
