Example #1
0
 async def start_new_season(self):
     now = datetime.utcnow()
     season_end = get_season_end()
     end = datetime(year=season_end[:4],
                    month=season_end[5:7],
                    day=season_end[-2:],
                    hour=5)
     if now > end:
         update_season(self.next_last_monday())
Example #2
0
 async def season_info(self, ctx):
     """Command to display the season information"""
     embed = discord.Embed(title="Season Information",
                           color=discord.Color.green())
     embed.add_field(name="Season Start",
                     value=coc_season.get_season_start())
     embed.add_field(name="Season End", value=coc_season.get_season_end())
     embed.add_field(name="Days Left", value=coc_season.get_days_left())
     embed.set_thumbnail(url="http://www.mayodev.com/images/clock.png")
     response = await ctx.send(embed=embed)
     self.bot.messages[ctx.message.id] = response
Example #3
0
 async def season(self, ctx):
     """Group of commands to deal with the current COC season"""
     if ctx.invoked_subcommand is None:
         embed = discord.Embed(title="Season Information",
                               color=discord.Color.green())
         embed.add_field(name="Season Start",
                         value=coc_season.get_season_start())
         embed.add_field(name="Season End",
                         value=coc_season.get_season_end())
         embed.add_field(name="Days Left", value=coc_season.get_days_left())
         embed.set_thumbnail(url="http://www.mayodev.com/images/clock.png")
         response = await ctx.send(embed=embed)
         self.bot.messages[ctx.message.id] = response
Example #4
0
 async def change(self, ctx, arg: str = ""):
     """Command to modify the season information"""
     if datetime.now() < datetime.strptime(coc_season.get_season_end(),
                                           "%Y-%m-%d"):
         return await ctx.send(
             "I would much prefer it if you waited until the season ends to change the dates."
         )
     try:
         coc_season.update_season(arg)
     except:
         self.bot.logger.exception("season change")
         return
     response = await ctx.send(
         f"File updated.  The new season ends in {coc_season.get_days_left()} days."
     )
     self.bot.messages[ctx.message.id] = response