async def hourly_handler(self): time = datetime.datetime.now() today = datetime.date.today() yesterday = today - datetime.timedelta(days=1) channel = get_channel_from_name(self.bot, self.settings.get('io_channel')) if time.hour == 0: res = Stats.make_overall_leaderboard_dict(self.bot, yesterday) embed = Stats.make_overall_leaderboard_embed(res, yesterday) await channel.send( f"**Official overall leaderboard for {yesterday}**", embed=embed)
def run(): loop = get_event_loop() bot = loop.run_until_complete(Nanochan.get_instance()) cogs = [ Owner(bot), Spoils(bot), Filter(bot), Reactions(bot), Stats(bot), ] bot.start_bot(cogs)
def run(test: bool): loop = get_event_loop() if test: bot = loop.run_until_complete(Nanochan.get_test_instance()) else: bot = loop.run_until_complete(Nanochan.get_instance()) cogs = [ Fightclub(bot), Logging(bot), Owner(bot), Spoils(bot), Filter(bot), Reactions(bot), Janitor(bot), Stats(bot), Channels(bot), Pingy(bot), Tutoring(bot), Moderation(bot) ] bot.start_bot(cogs)
def run(): """ Builds the bot object using the various cogs """ loop = get_event_loop() bot = loop.run_until_complete(Yinbot.get_instance()) cogs = [ Admin(bot), Filter(bot), Gateway(bot), Info(bot), Logging(bot), Moderation(bot), RNG(bot), Roles(bot), Slowmode(bot), Stats(bot), Voice(bot), Owner(bot), Warnings(bot), Pings(bot) ] bot.start_bot(cogs)
def get_prefix(bot, message): return settings.get('prefix') bot = commands.Bot(command_prefix=get_prefix) bot.owner_id = settings.get('owner_id') log.debug('Loading cogs...') bot.add_cog(Util.Util(bot, settings)) bot.add_cog(Quirky.Quirky(bot, settings)) bot.add_cog(Water.Water(bot, settings)) bot.add_cog(Workout.Workout(bot, settings)) bot.add_cog(Stats.Stats(bot, settings)) bot.add_cog(Timer.Timer(bot, settings)) log.debug('Loading events...') @bot.event async def on_ready(): log.debug(f"We have logged in as {bot.user}") await bot.change_presence(status=discord.Status.online, activity=discord.Game(name='with 💦')) @bot.event async def on_disconnect(): log.debug('Disconnected...')