async def leaderboardInterval(self, ctx, days: str): try: self.settings.leaderboardInterval = int(days) update_setting(self.conn, (days,'leaderboardInterval')) await ctx.send('leaderboardInterval set to: ' + days + ' days') except ValueError as e: await ctx.send('Invalid Number of Days! The number of days should only consist of an integer number!')
async def expLevelH(self, ctx, exp: str): try: self.settings.expLevelH = int(exp) update_setting(self.conn, (exp,'expLevelH')) await ctx.send('expLevelH set to: ' + exp + ' messages') except ValueError as e: await ctx.send('Invalid Amount of Experience! The experience amount should only consist of an integer number!')
async def pinsRoles(self, ctx, *, roles: str): roles = roles.split(',') rolesList = [0]*len(roles) rolesmsg = '' savestring = '' for i,role in enumerate(roles): try: role = int(role) if ctx.guild.get_role(role) != None: rolesList[i] = role if i == 0: rolesmsg += ctx.guild.get_role(role).mention savestring += str(role) else: rolesmsg += ', ' + ctx.guild.get_role(role).mention savestring += ',' + str(role) else: await ctx.send('At least one of the provided role IDs is invalid!') return except ValueError as e: await ctx.send('At least one of the provided role IDs is invalid!') return update_setting(self.conn, (savestring,'pinsRoles')) self.settings.pinsRoles = rolesList await ctx.send('pinsRoles set to: ' + rolesmsg)
async def rankingMessage(self, ctx, message: str): try: actualMessage = await self.bot.get_channel(self.settings.rankingChannel).fetch_message(int(message)) self.settings.rankingMessage = int(message) update_setting(self.conn, (message,'rankingMessage')) await ctx.send('rankingMessage set to: ' + actualMessage.jump_url) except ValueError as e: await ctx.send('Invalid ID! The message ID should only consist of an integer number!')
async def messagesPostTime(self, ctx, *, dateTime: str): try: date = datetime.strptime(dateTime + ' UTC+0000', '%d/%m/%Y %H:%M %Z%z') timeStamp = date.timestamp() update_setting(self.conn, (timeStamp,'messagesPostTime')) self.settings.messagesPostTime = int(timeStamp) await ctx.send('messagesPostTime set to: ' + dateTime + ' UTC. The messages leaderboard will be posted according to the leaderboardInterval starting then.') except ValueError as e: await ctx.send('Invalid dateTime! The dateTime format should be input as: DD/MM/YYYY HH:mm!')
async def highestRole(self, ctx, role: str): try: if ctx.guild.get_role(int(role)) != None: update_setting(self.conn, (role,'highestRole')) self.settings.highestRole = int(role) await ctx.send('highestRole set to: ' + ctx.guild.get_role(int(role)).mention) else: await ctx.send('No role with the provided ID was found!') except ValueError as e: await ctx.send('Invalid ID! The role ID should only consist of an integer number!')
async def kingdomEmoji(self, ctx, emoji: str): try: if self.bot.get_emoji(int(emoji)) != None: update_setting(self.conn, (emoji,'kingdomEmoji')) self.settings.kingdomEmoji = int(emoji) await ctx.send('kingdomEmoji set to: ' + str(self.bot.get_emoji(int(emoji)))) else: await ctx.send('No emoji with the provided ID was found!') except ValueError as e: await ctx.send('Invalid ID! The emoji ID should only consist of an integer number!')
async def moddingChannel(self, ctx, channel: str): try: if self.bot.get_channel(int(channel)) != None: update_setting(self.conn, (channel,'moddingChannel')) self.settings.moddingChannel = int(channel) await ctx.send('moddingChannel set to: ' + self.bot.get_channel(int(channel)).mention) else: await ctx.send('No channel with the provided ID was found!') except ValueError as e: await ctx.send('Invalid ID! The channel ID should only consist of an integer number!')
async def botActive(self, ctx, status: str): status = status.lower() if status == 'on' or status == 'true' or status == 'yes': update_setting(self.conn, ('True','botActive')) self.settings.botActive = True await ctx.send('botActive set to: `True`') elif status == 'off' or status == 'false' or status == 'no': update_setting(self.conn, ('False','botActive')) self.settings.botActive = False await ctx.send('botActive set to: `False`')
async def rankingChannel(self, ctx, channel: str): try: if self.bot.get_channel(int(channel)) != None: update_setting(self.conn, (channel,'rankingChannel')) self.settings.rankingChannel = int(channel) await ctx.send('rankingChannel set to: ' + self.bot.get_channel(int(channel)).mention) if self.settings.rankingMessage != None: update_setting(self.conn, (None,'rankingMessage')) self.settings.rankingMessage = None await ctx.send('The Ranking Channel was changed and thus the Ranking Message has been reset!\nUse `/set rankingMessage MessageID` to set it again!') else: await ctx.send('No channel with the provided ID was found!') except ValueError as e: await ctx.send('Invalid ID! The channel ID should only consist of an integer number!')
async def guildID(self, ctx): update_setting(self.conn, (str(ctx.guild.id),'guildID')) self.settings.guildID = ctx.guild.id await ctx.send('guildID set to: ' + ctx.bot.get_guild(self.settings.guildID).name)