async def on_command_error(ctx, error): if isinstance(error, commands.CheckFailure) or isinstance(error, commands.CommandNotFound): pass elif isinstance(error, commands.BadArgument): embed = utils.createEmbed( description=f'Error: There was an error with the command arguments.\n\nUsage:\n`{ctx.command.usage}`', colour='error', author=ctx.author) await ctx.send(embed=embed) elif isinstance(error, commands.MissingRequiredArgument): embed = utils.createEmbed( description=f'Error: Your are missing an argument.\n\nUsage:\n`{ctx.command.usage}`', colour='error', author=ctx.author) await ctx.send(embed=embed) else: try: embed = utils.createEmbed( title='An error eccured', description=f'\ **{type(error)}**\n\ ```{error}```\n\n\ [Jump](https://discordapp.com/channels/{ctx.guild.id}/{ctx.channel.id}/{ctx.message.id})', author=ctx.author, colour='error' ) embed.set_footer(text=ctx.guild.name, icon_url=ctx.guild.icon_url_as(format='png', size=128)) app = await client.application_info() await app.owner.send(embed=embed) raise error except Exception as error: tb = traceback.format_exc() print(error, tb)
async def edit(self, ctx, platform: str , *, gamertag): platform = platform.lower() if platform not in self.gt_platforms: embed = utils.createEmbed(author=ctx.author, colour='error', description=f'You need to select one of these platforms:\n• `' + '`\n• `'.join(self.gt_platforms) + '`') await ctx.send(embed=embed) return self.Storage.update_gamertag(ctx.author, platform, gamertag) embed = utils.createEmbed(description=f'Your {platform} gamertag has been updated to `{gamertag}`.', author=ctx.author, colour='iron') embed.set_footer(icon_url=ctx.guild.icon_url_as(format='png', size=128), text='Gamertag updated') await ctx.send(embed=embed)
async def _s_edit(self, ctx, platform: str , *, username): platform = platform.lower() if platform not in self.social_platforms: embed = utils.createEmbed(author=ctx.author, colour='error', description=f'You need to select one of these platforms:\n• `' + '`\n• `'.join(self.social_platforms) + '`') await ctx.send(embed=embed) return self.Storage.update_social_media(ctx.author, platform, username) embed = utils.createEmbed(description=f'Your {platform} username has been updated to `{username}`.', author=ctx.author, colour='iron') embed.set_footer(icon_url=ctx.guild.icon_url_as(format='png', size=128), text='Username updated') await ctx.send(embed=embed)
async def help(ctx, *, name: str = None): if name: embed = utils.createEmbed(colour='iron') command = client.get_command(name=name) cog = client.get_cog(name=name) if cog: embed.title = f'__Module: {cog.qualified_name}__' txt = '' for command in cog.get_commands(): txt += f'{client.command_prefix[0]}{command.name} - {command.brief}\n' embed.add_field(name='Commands', value=txt, inline=False) elif command: embed.title = f'__Command: {client.command_prefix[0]}{command.qualified_name}__' embed.add_field(name='Description', value=command.description, inline=False) if isinstance(command, discord.ext.commands.Group): embed.add_field(name='Subcommands', value='\n'.join(f'`{c.name}`' for c in command.commands), inline=False) embed.add_field(name='Usage', value=command.usage, inline=False) if len(command.aliases) > 0: embed.add_field(name='Aliases', value=', '.join(f'`{a}`' for a in command.aliases), inline=False) embed.set_footer(text=f'Module: {command.cog_name}') else: embed = utils.createEmbed( colour='error', description='Error: Command or Cog not found.', author=ctx.author) else: embed = utils.createEmbed( title='__Commands__', description= 'For a documentation of all commands go [here](https://gist.github.com/Cradac/4544f0cbe9456a637c0d3a85061bda78).', colour='iron') for name, cog in client.cogs.items(): commands = cog.get_commands() if len(commands) > 0: txt = '' for command in commands: if command.hidden: continue txt += f'{client.command_prefix[0]}{command.name} - {command.brief}\n' if txt != '': embed.add_field(name=cog.qualified_name, value=txt, inline=False) else: continue await ctx.send(embed=embed)
async def cmnds(self, ctx): embed = utils.createEmbed( author=ctx.author, description= 'You can view the command documentation of the Iron Justice right [here](https://gist.github.com/Cradac/4544f0cbe9456a637c0d3a85061bda78).', colour='iron') await ctx.send(embed=embed)
async def get_game_page(self, ctx, member: discord.Member): info = await self.Storage.get_tag_profile(ctx, member) if not info: return None embed = utils.createEmbed(colour='iron', author=member) embed.set_thumbnail(url=member.guild.icon_url_as(format='png', size=512)) embed.set_footer(icon_url=self.game_emoji_url, text='Gamertags') if info['steam']: embed.add_field(name=str(self.steam_emoji) + 'Steam', value=info['steam'], inline=True) if info['xbox']: embed.add_field(name=str(self.xbox_emoji) + 'Xbox Live', value=info['xbox'], inline=True) if info['psn']: embed.add_field(name=str(self.psn_emoji) + 'Playstation Network', value=info['psn'], inline=True) if info['nintendo']: embed.add_field(name=str(self.nintendo_emoji) + 'Nintendo Friend Code', value=info['nintendo'], inline=True) if info['gog']: embed.add_field(name=str(self.gog_emoji) + 'GoG', value=info['gog'], inline=True) if info['minecraft']: embed.add_field(name=str(self.minecraft_emoji) + 'Minecraft', value=info['minecraft'], inline=True) if info['origin']: embed.add_field(name=str(self.origin_emoji) + 'Origin', value=info['origin'], inline=True) if info['blizzard']: embed.add_field(name=str(self.blizzard_emoji) + 'Blizzard Net', value=info['blizzard'], inline=True) if info['bethesda']: embed.add_field(name=str(self.bethesda_emoji) + 'Bethesda', value=info['bethesda'], inline=True) if len(embed.fields) == 0: embed.description = f'{member} has not set any gamertags.' return embed
async def levels(self, ctx, *args): comps = dict() r = re.compile(r'^(([a-z]|[A-Z]){1,3}=([1-4][0-9]|50|[1-9])\s)*$') if not r.match(' '.join(args) + ' '): await ctx.send('The Syntax is not correct. Try this instead:\n`?levels gh=50`\n`?levels af=10 hc=50 gh=50 sd=50 ma=50 oos=50`') return for arg in args: arg = arg.split('=') try: comps[arg[0].lower()] = int(arg[1]) except ValueError: await ctx.send('Please only pass integers for levels.') return for comp,lvl in comps.items(): if comp not in ['gh', 'oos', 'ma', 'hc', 'sd', 'af']: await ctx.send(f'`{comp}` is not a correct trading company abbreviation.\nPossible abbreviations are: `gh`, `oos`, `ma`, `hc`, `sd`, `af`.') return if comp == 'af' and (not isinstance(lvl, int) or not 0 <= lvl <=10): await ctx.send('Athena\'s levels can only be between 0 and 10.') return if not isinstance(lvl, int) or not 0 < lvl <= 50: await ctx.send('Levels can only be between 1 and 50.') self.Storage.update_levels(ctx.author, comps) embed = utils.createEmbed(description=f'Your levels have been updated.', author=ctx.author, colour='iron') embed.set_footer(icon_url=ctx.guild.icon_url_as(format='png', size=128), text='Levels updated') await ctx.send(embed=embed)
async def user_info(self, ctx, *, member): member = await utils.memberSearch(ctx, self.client, member) if not member: return info = self.Storage.get_user_activity(member) embed = utils.createEmbed(author=member, colour='iron', guild=ctx.guild) embed.set_footer(text='Activity Info', icon_url=ctx.guild.icon_url_as(format='png', size=128)) if info['timestamp']: timestamp_str = info['timestamp'].strftime( self.Storage.datetime_scheme) days_gone = (datetime.utcnow() - info['timestamp']).days txt = f'{timestamp_str} ({days_gone} days ago)' else: txt = '`No messages sent.`' embed.add_field(name='__joined guild__', value=member.joined_at.strftime('%d %b %Y'), inline=False) embed.add_field(name='__last message (UTC TIME)__', value=txt, inline=False) embed.add_field(name='__amount of messages (last 30 days)__', value=info['amnt'], inline=False) await ctx.send(embed=embed)
async def guildlist(self, ctx): embed = utils.createEmbed(title='__List of Guilds__', description='\n'.join( f'{guild} `{guild.id}`' for guild in self.client.guilds), colour='iron') await ctx.send(embed=embed)
def rogue_welcome(self, user: discord.Member): description = f'It appears that {user.mention} has decided to go Rogue, and join us Legends!' embed = utils.createEmbed(description=description, author=user, guild=user.guild, colour='rogue') embed.set_footer(text=f'Member #{user.guild.member_count}', icon_url=user.guild.icon_url_as(format='png', size=128)) rules_txt = f'\ Please take a moment to read the {self.rogue["rules"].mention} & please provide the following information in a message below.\n\n\ **1.** Gamertag\n\ **2.** Age\n\ **3.** Do you stream? (if so please provide streaming channel URL)\n\ **4.** Are you an Insider? (Formerly Pioneer)\n\ **5.** How did you find Rogue Legends?' game_txt = f'After you applied and we\'ve set your rank please head to {self.rogue["info"].mention} and react with the emoji according to the games you play to get access to their categories!' joined_txt = f'Please leave a message in {self.rogue["rollcall"].mention} with the some information about you. Check the pinned message there for format.\n\n\ Make sure you see the {self.rogue["announcements"].mention} channel for important information. (please do not mute the channel)' embed.add_field(name='__Rules and Server Access__', value=rules_txt) embed.add_field(name='__Game Channel Access__', value=game_txt) embed.add_field(name='__Once you have Server Access__', value=joined_txt) return embed
async def github(self, ctx): embed = utils.createEmbed( author=ctx.author, description= 'Visit the Iron Justice on [GitHub](https://github.com/Cradac/Iron-Justice) and check out the latest additions. Please Star the repository!', colour='iron') await ctx.send(embed=embed)
async def _s_list(self, ctx): embed = utils.createEmbed( author=ctx.author, colour='iron', description=f'You can select of these platforms:\n• `' + '`\n• `'.join(self.social_platforms) + '`') await ctx.send(embed=embed)
async def whois(self, ctx, *, rolename: str, page: typing.Optional[int] = 1): role = await utils.roleSearch(ctx, self.client, rolename) if not role: return users = list() for member in ctx.guild.members: if role in member.roles: users.append(member) users.sort(key=lambda x: x.name) sumpages = math.ceil(len(users) / 20) page = sumpages if page > sumpages else page pagestart = (page * 20) - 20 pageend = pagestart + 19 desctext = f'({str(len(users))} in total)\n' for i in range(pagestart, pageend): try: desctext += users[i].mention + '\n' except IndexError: break embed = utils.createEmbed(title=f'__Users with the role `{role}`:__', description=desctext, colour='iron', author=ctx.author) embed.set_footer(text=f'Page {page}/{sumpages}') await ctx.send(embed=embed)
def get_auto_voice_names(self, ctx): l = self.Storage.get_auto_voice_names(ctx.guild) l = l if len(l) > 0 else auto_voice.channel_names return utils.createEmbed(title='__**List of voice channel names**__', description='• ' + '\n• '.join(l), colour='iron', author=ctx.author, guild=ctx.guild)
async def guild_info(self, ctx): embed = utils.createEmbed(author=ctx.author, guild=ctx.guild, colour='iron') guild = ctx.guild guild_info = f'**Guild Name:** `{guild.name}`\n**Guild ID:** `{guild.id}`\n**Owner:** {guild.owner.mention}\n**Member Count:** {guild.member_count}' embed.add_field(name="__Guild Info__", value=guild_info) # Looking for Crew Settings lfc_settings = self.Storage.get_lfc_settings(guild) lfc_status = '`enabled`' if lfc_settings['status'] else '`disabled`' embed.add_field(name='__Looking for Crew Module__', value=lfc_status, inline=False) if lfc_settings['status']: lfc_channels = ' '.join( c.mention for c in lfc_settings['channels']) if len( lfc_settings['channels']) > 0 else 'all channels' embed.add_field(name='__Looking for Crew Channels__', value=lfc_channels) embed.add_field(name='__Looking for Crew Role__', value=lfc_settings['role'].mention) # Profile Settings profile_settings = self.Storage.get_profile_settings(guild) profile_status = '`enabled`' if profile_settings[ 'status'] else '`disabled`' embed.add_field(name='__Profile Module__', value=profile_status, inline=False) if profile_settings['status']: profile_channels = ' '.join( c.mention for c in profile_settings['channels']) if len( profile_settings['channels']) > 0 else 'all channels' embed.add_field(name='__Profile Channels__', value=profile_channels) # Auto-Voice Settings auto_voice_settings = self.Storage.get_auto_voice_settings(guild) embed.add_field(name='__Auto-Voice Module__', value=auto_voice_settings['channel'] or '`disabled`', inline=False) if auto_voice_settings['channel']: names = auto_voice_settings['names'] names = 'Default Names' if len(names) == 0 else ' '.join( f'`{n}`' for n in names) embed.add_field(name='__Auto-Voice Custom Names__', value=names) # Activity-Logging Settings activity_logging_settings = self.Storage.get_activity_logging_status( guild) activity_logging_status = '`enabled`' if activity_logging_settings else '`disabled`' embed.add_field(name='__Activity-Logging Module__', value=activity_logging_status, inline=False) await ctx.send(embed=embed)
def hogf_welcome(self, user: discord.Member): embed = utils.createEmbed(author=user, guild=user.guild, colour=0xffb53b) embed.description = f'Welcome to Hearts of Gold. Please review the {self.hogf["rules"].mention} and use the reaction role to agree to them. Once you have done this please make sure you familirize yourself with the {self.hogf["guide"].mention}. If you have any questions please ask an HoGF Admin or Mod.' embed.set_footer(text=f'Member #{user.guild.member_count}', icon_url=user.guild.icon_url_as(format='png', size=128)) return embed
async def alias(self, ctx, *, alias: str = None): if not alias: txt = 'Your alias has been removed.' else: txt = 'Your alias has been updated.' self.Storage.update_alias(ctx.author, alias) embed = utils.createEmbed(description=txt, author=ctx.author, colour='iron') embed.set_footer(icon_url=ctx.guild.icon_url_as(format='png', size=128), text='Image updated') await ctx.send(embed=embed)
async def activity_logging(self, ctx, status: bool): self.Storage.update_activity_logging_status(ctx.guild, status) s = 'enabled' if status else 'disabled' global active_fleets active_fleets.add(ctx.guild) if status else active_fleets.discard( ctx.guild) embed = utils.createEmbed(title='**__`Activity-Logging`-Setup__**', description=f'The module is {s}.', colour='iron', guild=ctx.guild) await ctx.send(embed=embed)
async def roll(self, ctx, arg: str = None): if not arg: amnt, sides, modifier = 1, 6, 0 else: if not 'd' in arg: embed = utils.createEmbed( title='Wrong Syntax', description= 'The Syntax is wrong. Try something similar to this: `1d6+1`, `2d10`, `d20`', colour='error', author=ctx.author) await ctx.send(embed=embed) rslt = arg.split('d', 1) if rslt[0] == '': amnt = 1 rest = rslt[1] else: amnt = int(rslt[0]) rest = rslt[1] if '+' in rest: sides, modifier = rest.split('+', 1) elif '-' in rest: sides, modifier = rest.split('-', 1) modifier = int(modifier) modifier *= -1 else: sides = rest modifier = 0 results = list() sides, modifier = int(sides), int(modifier) for _ in range(amnt): results.append(random.randint(1, sides)) result = sum(results) + modifier embed = utils.createEmbed( title=f'You rolled {amnt} d{sides}.', description= f'Result: {result}\nIndividual rolls:\n{", ".join(f"`{r}`" for r in results)}', author=ctx.author, colour='iron') await ctx.send(embed=embed)
async def img(self, ctx, url: str = None): if not url and len(ctx.message.attachments) > 0: url = ctx.message.attachments[0].url if not url: txt = 'Your profile image has been removed.' elif url[-4:] in ['.jpg', '.png', '.gif']: txt = 'Your profile image has been updated.' else: await ctx.send('The image type as to be either jpg, png or gif.') return self.Storage.update_img(ctx.author, url) embed = utils.createEmbed(description=txt, author=ctx.author, colour='iron') embed.set_footer(icon_url=ctx.guild.icon_url_as(format='png', size=128), text='Image updated') await ctx.send(embed=embed)
async def get_sot_page(self, ctx: commands.Context, member: discord.Member): info = await self.Storage.get_sot_profile(ctx, member) if not info: return None embed = utils.createEmbed(colour='iron', author=member, guild=member.guild) embed.set_footer(icon_url=self.sot_emoji.url, text='Sea of Thieves') embed.add_field(name="<:xbox:684482808185618474> Gamertag", value=info['gtag'], inline=False) if info['alias']: embed.add_field( name="<:jollyroger:486619773875126293> Pirate Alias", value=info['alias'], inline=False) embed.add_field(name="<:rank:486619774445551626> Rank", value=member.top_role.name, inline=False) embed.add_field(name="<:gh:486619774424449036> Gold Hoarders", value=info['gh'], inline=True) embed.add_field(name="<:oos:486619776593166336> Order of Souls", value=info['oos'], inline=True) embed.add_field(name="<:ma:486619774688952320> Merchant Alliance", value=info['ma'], inline=True) embed.add_field(name="<:hc:588378278772080641> Hunter's Call", value=info['hc'], inline=True) embed.add_field(name="<:sd:588378278813761609> Sea Dogs", value=info['sd'], inline=True) embed.add_field(name="<:af:486619774122459178> Athena's Fortune", value=info['af'], inline=False) if info['img']: embed.set_image(url=info['img']) alliances = [ info['gh'] == 50, info['oos'] == 50, info['ma'] == 50, info['hc'] == 50, info['sd'] == 50 ] true_count = sum(alliances) if true_count >= 3: embed.add_field(name="You are a Legend!", value='\u200b', inline=False) return embed
def iron_welcome(self, user: discord.Member): description = f'Excelsior! It seems {user.mention} has drunkenly washed ashore onto The Iron Islands!\nOur forces have reached {user.guild.member_count} strong!' embed_public = utils.createEmbed(description=description, author=user, guild=user.guild, colour='iron') embed_public.set_footer(text=f'#{user.guild.member_count} Ironborn', icon_url=user.guild.icon_url_as(format='png', size=128)) txt1 = f'Please take a moment to read the {self.iron["rules"].mention} and click the reaction emoji to indicate that you\'ve done so. This will open you up to the application channel.' txt2 = f'To apply, submit an application in {self.iron["intro"].mention}.\n\ Head over to {self.iron["info"].mention} to read up on our FAQ, get our social media links and general info about the fleet.\n\ Feel free to message a Junior or Senior Officer if you have any questions or need any help.' embed_private = utils.createEmbed(guild=user.guild, colour='iron') embed_private.set_footer(text=f'#{user.guild.member_count} Ironborn', icon_url=user.guild.icon_url_as(format='png', size=128)) embed_private.add_field( name=f'Ahoy, {user.name} and welcome to the Iron Fleet!', value=txt1) embed_private.add_field(name='Afterwards...', value=txt2) return embed_public, embed_private
def get_page(self, users, page, role): sumpages = math.ceil(len(users) / 20) pagestart = (page * 20) - 20 pageend = pagestart + 19 desctext = f'({str(len(users))} in total)\n' for i in range(pagestart, pageend): try: desctext += users[i].mention + '\n' except IndexError: break embed = utils.createEmbed(title=f'__Users with the role `{role}`:__', description=desctext, colour='iron') embed.set_footer(text=f'Page {page}/{sumpages}') return embed
async def on_message(message): if type(message.channel) is discord.DMChannel: return log_channel = discord.utils.get(message.guild.channels, name="message-log") if not log_channel : await client.process_commands(message) return if not message.author.bot: jump_to_message = f'[Jump](https://discordapp.com/channels/{message.guild.id}/{message.channel.id}/{message.id})' embed = utils.createEmbed(description=f'in {message.channel.mention}:\n{message.content}\n{jump_to_message}', colour='iron', author=message.author) embed.set_footer(text=message.author.id) if len(message.attachments) > 0: embed.set_image(url=message.attachments[0].url) await log_channel.send(embed=embed) await client.process_commands(message)
async def auto_voice(self, ctx, *, channel: discord.VoiceChannel = None): self.Storage.update_auto_voice_channel( ctx.guild, channel) #TODO does this work with None? if channel: txt = f'\ Set the channel `{channel.name}` as Auto-Voice Channel.\n\ If you want to add custom names please use the `?auto-voice-names add <names>` command.' else: txt = 'The module is disabled.' embed = utils.createEmbed(title='**__`Auto-Voice`-Setup__**', description=txt, colour='iron', guild=ctx.guild) await ctx.send(embed=embed)
def get_xbox_page(self, member: discord.Member): gtag = self.Storage.get_xbox_tag(member) embed = utils.createEmbed(colour='iron', author=member) icon = member.guild.icon_url_as(format='png', size=512) embed.set_thumbnail(url=icon) embed.set_footer(icon_url=self.xbox_emoji.url, text='Xbox') if gtag: xbox_profile = xbox.GamerProfile.from_gamertag(gtag) embed.add_field(name='__Gamertag__', value=xbox_profile.gamertag) embed.add_field(name='__Gamerscore__', value=xbox_profile.gamerscore) embed.set_image(url=xbox_profile.gamerpic) else: embed.description = 'There is no Xbox Gamertag set for this profile.\n\ If this is your profile you can add it with `?gt edit <gamertag>`.' return embed
async def on_guild_join(self, guild): #Pn3vXNd embed = utils.createEmbed( title='__**The Iron Justice welcomes you!**__', description= 'Ahoy! This is The Iron Justice bot, brought to you by The Iron Fleet.\n\ ou can use ?help at any time to get a list of commands and/or more info on specific commands.\n\ To get started use ?config <option> and go through the installation wizard.\ Additionally, you can set up a message log by simply creating a channel named `#message-log` (note: the bot must have read and write permissions for this channel.)\n\ For additional support contact the developer Cradac | Max#2614 on discord. You can also join the [Support Server](https://discord.gg/Pn3vXNd)\n\ Enjoy!', colour='iron', guild=guild, author=guild.owner) await guild.owner.send(embed=embed) role = await guild.create_role(name='lfc', mentionable=True, colour=discord.Color(0xFFFFFF)) self.Storage.add_guild(guild, role)
async def get_social_page(self, ctx, member: discord.Member): info = await self.Storage.get_social_profile(ctx, member) if not info: return None embed = utils.createEmbed(colour='iron', author=member) embed.set_thumbnail( url=member.guild.icon_url_as(format='png', size=512)) embed.set_footer(icon_url=self.social_emoji.url, text='Social Media') if info['twitch']: embed.add_field( name=str(self.twitch_emoji) + 'Twitch', value= f'[{info["twitch"]}](https://www.twitch.tv/{info["twitch"]})', inline=True) if info['youtube']: embed.add_field(name=str(self.youtube_emoji) + 'Youtube', value=info["youtube"], inline=True) if info['mixer']: embed.add_field( name=str(self.mixer_emoji) + 'Mixer', value=f'[{info["mixer"]}](https://mixer.com/{info["mixer"]})', inline=True) if info['twitter']: embed.add_field( name=str(self.twitter_emoji) + 'Twitter', value= f'[{info["twitter"] if info["twitter"].startswith("@") else "@" + info["twitter"]}](https://twitter.com/{info["twitter"].replace("@", "")})', inline=True) if info['reddit']: embed.add_field( name=str(self.reddit_emoji) + 'Reddit', value= f'[{info["reddit"]}](https://www.reddit.com/user/{info["reddit"]})', inline=True) if info['itchio']: embed.add_field( name=str(self.itchio_emoji) + 'Itch.io', value=f'[{info["itchio"]}(https://{info["itchio"]}.itch.io/)', inline=True) if len(embed.fields) == 0: embed.description = f'{member} has not set any social media names.' return embed
async def profile(self, ctx, status: bool = None, channels: commands.Greedy[discord.TextChannel] = None): if status is not None: self.Storage.update_profile_status(ctx.guild, status) if channels and status: self.Storage.add_profile_channels(ctx.guild, channels) else: self.Storage.delete_all_profile_channels(ctx.guild) # WIZARD else: def reaction_check(reaction, user): return user == ctx.message.author and str( reaction.emoji) in ["✅", "❌"] # Turn on or off msg = await ctx.send( 'Do you want to enable the `Profile`-Module? Please react below.' ) await msg.add_reaction("✅") await msg.add_reaction("❌") try: r = await self.client.wait_for('reaction_add', timeout=30.0, check=reaction_check) except asyncio.TimeoutError: await ctx.send('Cancelled the Setup.') status = str(r[0]) == '✅' self.Storage.update_profile_status(ctx.guild, status) s = 'on' if status else 'off' await ctx.send(f'The `Profile`-Module is now turned {s}.') if status: def message_check(msg): return msg.author == ctx.author and msg.content # Select channels await ctx.send( 'Please mention all channels you want to enable the module in. If you don\'t want to restrict it to certain channels just type `all`.' ) try: msg = await self.client.wait_for('message', timeout=60.0, check=message_check) except asyncio.TimeoutError: await ctx.send('Cancelled the Setup.') channels = msg.channel_mentions if len(channels) > 0: self.Storage.add_profile_channels(ctx.guild, msg.channel_mentions) await ctx.send( 'The `Profile`-Module can be used in all mentioned channels.' ) else: self.Storage.delete_all_profile_channels(ctx.guild) await ctx.send( 'The `Profile`-Module can be used in all channels.') else: self.Storage.delete_all_profile_channels(ctx.guild) # Send Settings Embed s = 'enabled' if status else 'disabled' embed = utils.createEmbed(title='**__`Profile`-Setup__**', description=f'The module is {s}.', colour='iron', guild=ctx.guild) ch = '`all`' if not channels or len(channels) == 0 else ' '.join( c.mention for c in channels) embed.add_field(name='__Channels__', value=ch) await ctx.send(embed=embed)