Example #1
0
 async def CutoffUpdatesFormatting(self, server: str, tier):
     UpdateCheck = False
     CurrentCutoffs = await GetBestdoriCutoffAPI(server, tier)
     if server == 'en':
         CachedCutoffs = self.ENCutoffs
     else:
         CachedCutoffs = self.JPCutoffs
     if sorted(CurrentCutoffs.items()) != sorted(CachedCutoffs[tier].items()):
         output = await GetCutoffFormatting(server, tier, False)
         ids = getCutoffChannels(tier, server)
         for i in ids:
             channel = self.bot.get_channel(i)
             if channel != None:
                 try:
                     await channel.send(f't{tier} update found!')
                     await channel.send(embed=output)
                     UpdateCheck = True                                
                 except (commands.BotMissingPermissions, discord.errors.NotFound): 
                     rmChannelFromCutoffDatabase(channel, tier, 'en')
     return UpdateCheck, CurrentCutoffs
Example #2
0
 async def rmt100updates(self,
                         ctx,
                         tier: int = 100,
                         channel: TextChannel = None):
     if ctx.message.author.guild_permissions.administrator:
         if (channel == None):
             channel = ctx.channel
         await ctx.send(rmChannelFromCutoffDatabase(channel, tier))
     else:
         msg = "You must have administrator rights to run this command, {0.author.mention}".format(
             ctx.message)
         await ctx.send(msg)
Example #3
0
 async def rmt100updates(self,
                         ctx,
                         server: str = 'en',
                         tier: int = None,
                         channel: TextChannel = None):
     if ctx.message.author.guild_permissions.administrator:
         ValidServers = {'jp', 'en'}
         ValidServersByTier = {
             100: ['en', 'jp'],
             1000: ['en', 'jp'],
             2000: ['jp'],
             2500: ['en'],
             5000: ['jp'],
             10000: ['jp']
         }
         if server not in ValidServers:
             output = f"The `{server}` server doesn't currently have cutoff update notifications enabled or it is not a valid server"
         elif tier not in ValidServersByTier.keys() and tier != 0:
             output = f"That tier isn't being tracked by Bestdori"
         else:
             if (channel == None):
                 channel = ctx.channel
             if tier == 0:
                 try:
                     for tier in ValidServersByTier:
                         if server in ValidServersByTier[tier]:
                             rmChannelFromCutoffDatabase(
                                 channel, tier, server)
                     output = f"Channel `{channel.name}` will stop receiving all cutoff updates for `{server}`"
                 except:
                     output = f"Failed removing {channel.name} from the cutoff updates database"
             else:
                 output = rmChannelFromCutoffDatabase(channel, tier, server)
     else:
         output = "You must have administrator rights to run this command, {0.author.mention}".format(
             ctx.message)
     await ctx.send(output)