async def rtogglechannel(self, ctx, channel: discord.TextChannel = None): '''Add channel to the starboard black/whitelist. example usage: ``````css ?rtogglechannel ``````css ?rtc''' fd = data.get_data(ctx.guild) channels = fd['rchannels'] if channel.id in channels: channels.remove(channel.id) change = 'removed' else: channels.append(channel.id) change = 'added' fd['rchannels'] = channels if fd['rchannel_on']: desc = f'<#{channel.id}> has been {change} to the star whitelist' else: desc = f'<#{channel.id}> has been {change} to the star blacklist' embed = discord.Embed(title='**Channel Toggle**', description=desc, color=0x00ff88) prefix = data.get_data(ctx.guild)['prefix'] embed.set_footer(text=f'Use {prefix}rtl to toggle black/whitelist') await ctx.send(embed=embed) await data.set_data(ctx.guild, fd)
async def setchannel(self, ctx, channel: discord.TextChannel = None): '''Sets the starboard channel. A channel can be mentioned in the command. In case any channel is not mentioned, the channel in which the message is sent is set as the starboard channel. example usage: ``````css ?setchannel starboard //sets the starboard channel to a channel called starboard ``````css ?sc ``````css ?starchannel ``````css ?starchan ''' msg = ctx.message if channel is None: channel = msg.channel failed = False if not failed: fd = data.get_data(ctx.guild) fd['channel'] = str(channel.id) desc = f'Starboard channel set to <#{channel.id}>.' embed = discord.Embed(title='**Starboard Channel**', description=desc, color=0xff9500) await data.set_data(ctx.guild, fd) await ctx.send(embed=embed)
async def setmin(self, ctx, amount: int): '''Sets the required amount of stars for a message to be pinned. example usage: ``````css ?setmin 5 ``````css ?min 6 ``````css ?setreq 12 ''' fd = data.get_data(ctx.guild) fd['min'] = amount await data.set_data(ctx.guild, fd) desc = f'Minimum amount of stars set to `{amount}`.' embed = discord.Embed(title='**Star Minumum**', description=desc, color=0x73ff00) await ctx.send(embed=embed)
async def set_prefix(self, ctx, prefix: str): '''Sets the bot prefix. example usage: ``````css ?prefix $''' bot_data = data.get_data(ctx.guild) if bot_data['prefix'] == prefix: desc = (f'The prefix is already `{prefix}`!') else: bot_data['prefix'] = prefix await data.set_data(ctx.guild, bot_data) self.bot.command_prefix = prefix desc = (f'Prefix has been changed to `{prefix}`.') embed = discord.Embed(title='**Prefix**', description=desc, color=0x00ffea) await ctx.send(embed=embed)
async def rtogglelist(self, ctx): '''Toggles the (starboard) black/whitelisting of the channel list. If the channel list is a whitelist, the stars in channels in the list will be considered for starboard. If the channel list is a blacklist instead, stars in every channel but those in the list will be considered. example usage: `````css ?rtogglelist ``````css ?rtl ''' fd = data.get_data(ctx.guild) channel_on = fd['rchannel_on'] channel_on = not channel_on fd['rchannel_on'] = channel_on if channel_on: title = '**Starboard Whitelist**' desc = 'Starboard channel whitelist has been enabled.' color = 0x00940c footer = 'All channels in the channel list are now whitelisted ' 'from the starboard' else: title = '**Starboard Blacklist**' desc = 'Starboard channel blacklist has been enabled.' color = 0x940000 footer = 'All channels in the channel list are now blacklisted ' 'from the starboard' embed = discord.Embed(title=title, description=desc, color=color) embed.set_footer(text=footer) await ctx.send(embed=embed) await data.set_data(ctx.guild, fd)
async def togglelist(self, ctx): '''Toggles the (command) black/whitelisting of the channel list. If the channel list is a whitelist, the user may use starboard commands in the channels in the list. If the channel list is a blacklist instead, users may use the starboard commands in every channel in the guild but those in the list. Example Usage: ``````css ?togglelist ``````css ?tl ''' fd = data.get_data(ctx.guild) channel_on = fd['channel_on'] channel_on = not channel_on fd['channel_on'] = channel_on if channel_on: title = '**Command Whitelist**' desc = 'Command channel whitelist has been enabled.' color = 0x00940c footer = 'All channels in the channel list are now whitelisted ' 'from the Command' else: title = '**Command Blacklist**' desc = 'Command channel blacklist has been enabled.' color = 0x940000 footer = 'All channels in the channel list are now blacklisted ' 'from the Command' embed = discord.Embed(title=title, description=desc, color=color) embed.set_footer(text=footer) await ctx.send(embed=embed) await data.set_data(ctx.guild, fd)