Exemplo n.º 1
0
 async def postSongUpdates1min(self):
     await self.bot.wait_until_ready()
     while not self.bot.is_closed():
         try:
             EnEventID = await GetCurrentEventID('en')
         except Exception as e:
             print('Failed posting 1 minute song data. Exception: ' + str(e))            
         if EnEventID:
             timeLeft = await GetEventTimeLeftSeconds('en', EnEventID)
             if(timeLeft > 0):
                 message = await t10membersformatting('en', EnEventID, True, 158699060893581313)
                 if message != "This event doesn't have a song ranking.":
                     #await t10logging('en', eventid, True)
                     ids = getChannelsToPost(1, 'en')
                     for i in ids:
                         channel = self.bot.get_channel(i)
                         if channel != None:
                             try:
                                 for x in message:
                                     await channel.send(x)
                             except (commands.BotMissingPermissions, discord.errors.NotFound, discord.errors.Forbidden): 
                                 LoopRemovalUpdates = self.bot.get_channel(523339468229312555)
                                 await LoopRemovalUpdates.send('Removing 1 minute updates from channel: ' + str(channel.name) + " in server: " + str(channel.guild.name))
                                 removeChannelFromDatabaseSongs(channel)
         timeStart = datetime.now()
         timeFinish = (timeStart + timedelta(minutes=1)).replace(second=0, microsecond=0).timestamp()
         timeStart = timeStart.timestamp()
         await asyncio.sleep(timeFinish - timeStart)
Exemplo n.º 2
0
 async def rmsongupdates(self, ctx, channel: TextChannel = None):
     if ctx.message.author.guild_permissions.administrator:
         if (channel == None):
             channel = ctx.channel
         await ctx.send(removeChannelFromDatabaseSongs(channel))
     else:
         msg = "You must have administrator rights to run this command, {0.author.mention}".format(
             ctx.message)
         await ctx.send(msg)