class TopGG(commands.Cog, name="TopGG"): def __init__(self, bot): self.bot = bot self.dblpy = DBLClient(bot=self.bot, token=TOPGG_TOKEN, autopost=True) async def on_guild_post(self): print( str(datetime.today()) + " --- Posted on {} guilds".format(self.dblpy.guild_count()))
def __init__(self): BaseClient.__init__( self, 'Guild Client') self.top_gg = DBLClient( self, getenv('TOKEN_TOP_GG'), webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000) self.bots_on_discord = BotsOnDiscordHandler( self, getenv('TOKEN_BOTS_ON_DISCORD')) self.discord_bots = DiscordBotsHandler( self, getenv('TOKEN_DISCORD_BOTS'))
class TopGG(commands.Cog): """Handles interactions with the top.gg API""" def __init__(self, bot, dbl_token): self.logger = logging.getLogger('bot') self.bot = bot self.token = dbl_token self.dblpy = DBLClient(self.bot, self.token, autopost=True) @tasks.loop(minutes=30.0) async def update_stats(self): """This function runs every 30 minutes to automatically update your server count""" while not self.bot.is_closed(): self.logger.info('Attempting to post server count') try: await self.dblpy.post_guild_count() self.logger.info('Posted server count ({})'.format( self.dblpy.guild_count())) except Exception as e: self.logger.exception( 'Failed to post server count\n{}: {}'.format(type(e).__name__, e)) await asyncio.sleep(1800)
def __init__(self, bot, dbl_token): self.logger = logging.getLogger('bot') self.bot = bot self.token = dbl_token self.dblpy = DBLClient(self.bot, self.token, autopost=True)
def __init__(self, bot): self.bot = bot self.token = getenv("DBL_TOKEN") self.dblpy = DBLClient(self.bot, self.token, autopost = True)
def __init__(self, bot): self.bot = bot self.token = os.getenv("DBL_TOKEN", "unset") self.dblpy = DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30
def __init__(self, bot): self.bot = bot self.dblpy = DBLClient(bot=self.bot, token=TOPGG_TOKEN, autopost=True)