async def remove_quote(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("RemoveQuote Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return args = _util.parse_message(ctx.content) if len(args) != 3: await ctx.channel.send(embed=_embedMessage.create( "RemoveQuote Reply", "Invalid Syntax! You need two arguments for this function!", "red") ) return if len(args[1]) > embed_field_max_char: await ctx.channel.send(embed=_embedMessage.create( "RemoveQuote Reply", "Quote is too long! Please submit a quote that is 1024 characters or fewer", "red")) return embed = _embedMessage.create( "RemoveQuote Reply", "\"" + args[1] + "\" by: " + args[2] + " \n Removed by: " + ctx.author.mention, "blue") await ctx.channel.send(embed=embed) _mongoFunctions.delete_quote(ctx.guild.id, args[1], args[2])
async def set_due_date_channel(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role(ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("SetDueDateChannel Reply", "Invalid Permissions", "red") await ctx.channel.send(embed = replyEmbed) return if not _mongoFunctions.get_settings(ctx.guild.id)['due_dates_enabled']: await ctx.channel.send(embed = _embedMessage.create("AddDueDate Reply", "Due Dates are not enabled on this server.", "red")) return _mongoFunctions.set_due_date_channel_id(ctx.guild.id, ctx.channel.id) await ctx.channel.purge(limit = None) dueDateEmbeds = {} dueDateMessages = {} for stream in _mongoFunctions.get_settings(ctx.guild.id)['streams']: dueDateEmbeds[stream] = _embedMessage.create("Stream {0} Due Dates Message".format(stream), "Temporary Message", "green") dueDateMessages[stream] = await ctx.channel.send(embed = dueDateEmbeds[stream]) await dueDateMessages[stream].pin() _mongoFunctions.set_due_date_message_id(ctx.guild.id, stream, dueDateMessages[stream].id) await _dueDateMessage.edit_due_date_message(client) # Purge all unpinned messages await ctx.channel.purge(limit = None, check = lambda msg: not msg.pinned)
async def lockdown(ctx: discord.message, client: discord.client): if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_admin_role(ctx.guild.id)) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("Lockdown Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return args = parse_message(ctx.content) if len(args) == 2: try: role = get(ctx.guild.roles, name=args[1]) except: replyEmbed = _embedMessage.create("Lockdown reply", "Invalid Role", "red") await ctx.channel.send(embed=replyEmbed) return replyEmbed = _embedMessage.create( "Lockdown Reply", "Channel Locked for {}".format(args[1]), "green") await ctx.channel.send(embed=replyEmbed) await ctx.channel.set_permissions(role, send_messages=False) else: replyEmbed = _embedMessage.create("Lockdown reply", "Error 404: Something went wrong", "red") await ctx.channel.send(embed=replyEmbed)
async def say(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("Say Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return global target_channel args = _util.parse_message(ctx.content) if len(args) != 4: await ctx.channel.send(embed=_embedMessage.create( "Say Reply", "Invalid Syntax! You need three arguments for this function!\nSyntax: say title content channel", "red")) return title = args[1] content = args[2] channel_mention = args[3] channels = client.get_all_channels() for channel in channels: if channel.mention == channel_mention: target_channel = channel break if target_channel is None: await ctx.channel.send(embed=_embedMessage.create( "Say Reply", "Channel not Found!", "red")) return try: await ctx.delete() except: print("Missing Manage Messages permission in {0} on server ID: {1}". format(channel.mention, str(ctx.guild.id))) if not _util.author_is_bot_owner(ctx): embed = _embedMessage.create( title, content + "\n\n This message was sent by {}".format(ctx.author.mention), "green") else: embed = _embedMessage.create(title, content, "green") await target_channel.send(embed=embed)
async def lockdown(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("Lockdown Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return args = parse_message(ctx.content) if len(args) == 1: for role in ctx.guild.roles: try: perms = ctx.channel.overwrites_for( role) # Use a permissions overwrite object perms.send_messages = False await ctx.channel.set_permissions(role, overwrite=perms) except: print("Unable to change permissions for {0}".format(role.name)) replyEmbed = _embedMessage.create( "Lockdown Reply", "Channel Locked for all possible roles", "green") await ctx.channel.send(embed=replyEmbed) elif len(args) == 2: role = get(ctx.guild.roles, name=args[1]) if role is None: replyEmbed = _embedMessage.create("Lockdown Reply", "Invalid Role", "red") await ctx.channel.send(embed=replyEmbed) return else: replyEmbed = _embedMessage.create( "Lockdown Reply", "Channel Locked for {}".format(args[1]), "green") await ctx.channel.send(embed=replyEmbed) # await ctx.channel.set_permissions(role, send_messages = False, read_messages = True) perms = ctx.channel.overwrites_for( role) # Use a permissions overwrite object perms.send_messages = False await ctx.channel.set_permissions(role, overwrite=perms) else: replyEmbed = _embedMessage.create( "Lockdown Reply", "This command needs can only take one argument.", "red") await ctx.channel.send(embed=replyEmbed)
async def force_birthdays(ctx, client): if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_admin_role(ctx.guild.id)) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("ForceBirthdays Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return await _birthdayMessage.send_birthday_message( client, ctx.guild.id, _mongoFunctions.get_bedi_bot_channel_id(ctx.guild.id)) await ctx.channel.send(embed=_embedMessage.create( "ForceBirthdays Reply", "Birthdays have been Forced", "blue")) return
async def force_announcement(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("ForceAnnouncement Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return await _morningAnnouncement.send_morning_announcement( client, ctx.guild.id, _mongoFunctions.get_settings(ctx.guild.id)['announcement_channel_id']) await ctx.channel.send(embed=_embedMessage.create( "ForceAnnouncement Reply", "Announcement has been **FORCED**", "blue")) return
async def say(ctx, client): if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_admin_role(ctx.guild.id)) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("Say Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return global target_channel args = _util.parse_message(ctx.content) if len(args) != 4: await ctx.channel.send(embed=_embedMessage.create( "Say Reply", "Invalid Syntax! You need three arguments for this function!", "red")) return title = args[1] content = args[2] channel_mention = args[3] channels = client.get_all_channels() for channel in channels: if channel.mention == channel_mention: target_channel = channel break if target_channel is None: await ctx.channel.send(embed=_embedMessage.create( "Say Reply", "Channel not Found!", "red")) return await ctx.delete() await target_channel.send( embed=_embedMessage.create(title, content, "green")) return
async def admin_verify(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("AdminVerify Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return if not _mongoFunctions.get_settings(ctx.guild.id)['verification_enabled']: replyEmbed = _embedMessage.create( "AdminVerify Reply", "Verification is not enabled on this server!", "red") await ctx.channel.send(embed=replyEmbed) return message_contents = ctx.content.split(" ") if len(message_contents) != 2: await ctx.channel.send(embed=_embedMessage.create( "AdminVerify Reply", "The syntax is invalid! Make sure it is in the format $adminverify <User (Mention)>\nNote that this command does NOT assign a role, it only verifies them inside the database!", "red")) return mention = message_contents[1] # Removes special characters from mention to end up with the user id user_id = mention.replace("<", "").replace(">", "").replace("@", "").replace("!", "") _mongoFunctions.admin_add_user_to_verified_users(ctx.guild.id, user_id) await ctx.guild.get_member(user_id).add_roles( discord.utils.get(ctx.guild.roles, name=_mongoFunctions.get_settings( ctx.guild.id)['verified_role'])) await ctx.channel.send( embed=_embedMessage.create("AdminVerify reply", mention + "has been verified", "blue"))
async def unlock(ctx: discord.message, client: discord.client): if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_admin_role(ctx.guild.id)) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("Unlock Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return args = parse_message(ctx.content) try: role = get(ctx.guild.roles, name=args[1]) except: replyEmbed = _embedMessage.create("Unlock reply", "Invalid Role", "red") await ctx.channel.send(embed=replyEmbed) replyEmbed = _embedMessage.create( "Unlock Reply", "Channel Unlocked for {}".format(args[1]), "green") await ctx.channel.send(embed=replyEmbed) await ctx.channel.set_permissions(role, send_messages=True)
async def set_bedi_bot_channel(ctx, client): if not (_checkrole.author_has_role(ctx, _mongoFunctions.get_admin_role(ctx.guild.id)) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("SetBediBotChannel Reply", "Invalid Permissions", "red") await ctx.channel.send(embed = replyEmbed) return await ctx.channel.purge(limit = None) await ctx.channel.send(embed = _embedMessage.create("SetBediBotChannel Reply", "The channel has been set!", "blue")) dueDateEmbeds = {} dueDateMessages = {} for stream in _mongoFunctions.get_list_of_streams(ctx.guild.id): dueDateEmbeds[stream] = _embedMessage.create("Stream {0} Due Dates Message".format(stream), "Temporary Message", "green") dueDateMessages[stream] = await ctx.channel.send(embed = dueDateEmbeds[stream]) await dueDateMessages[stream].pin() _mongoFunctions.set_due_date_message_id(ctx.guild.id, stream, dueDateMessages[stream].id) _mongoFunctions.set_bedi_bot_channel_id(ctx.guild.id, ctx.channel.id) await _dueDateMessage.edit_due_date_message(client) await ctx.channel.purge(limit = None, check = lambda msg: not msg.pinned)
async def remove_due_date(ctx: discord.Message, client: discord.Client): # This command is almost identical to $addduedate. Reference comments in that file. global course, due_date_type, stream, time, title, year, month, day wait_timeout = 60.0 sleep_time = 2 if not (_checkrole.author_has_role(ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): await ctx.channel.send(embed = _embedMessage.create("RemoveDueDate Reply", "Invalid Permissions", "red")) return if not _mongoFunctions.get_settings(ctx.guild.id)['due_dates_enabled']: await ctx.channel.send(embed = _embedMessage.create("RemoveDueDate Reply", "Due Dates are not enabled on this server.", "red")) return def check(message): return message.author == ctx.author and message.channel == ctx.channel response_message = await ctx.channel.send( embed = _embedMessage.create("RemoveDueDate Reply", "What course is this due date for?\nOptions: " + ', '.join(_mongoFunctions.get_settings(ctx.guild.id)['courses']), "blue")) while True: await response_message.edit( embed = _embedMessage.create("RemoveDueDate Reply", "What course is this due date for?\nOptions: " + ', '.join(_mongoFunctions.get_settings(ctx.guild.id)['courses']), "blue")) try: course_message = await client.wait_for('message', timeout = wait_timeout, check = check) except asyncio.TimeoutError: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "You took too long to respond.", "red")) return else: course = course_message.content if course not in _mongoFunctions.get_settings(ctx.guild.id)['courses']: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "The course name is invalid!", "red")) await asyncio.sleep(sleep_time) else: break while True: await response_message.edit( embed = _embedMessage.create("RemoveDueDate Reply", "What is the due date type?\nOptions: " + ', '.join(_mongoFunctions.get_settings(ctx.guild.id)['due_date_types']), "blue")) try: due_date_type_message = await client.wait_for('message', timeout = wait_timeout, check = check) except asyncio.TimeoutError: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "You took too long to respond.", "red")) return else: due_date_type = due_date_type_message.content if due_date_type not in _mongoFunctions.get_settings(ctx.guild.id)['due_date_types']: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "The due date type is invalid!", "red")) await asyncio.sleep(sleep_time) else: break if len(_mongoFunctions.get_settings(ctx.guild.id)['streams']) == 1: stream = _mongoFunctions.get_settings(ctx.guild.id)['streams'][0] else: while True: await response_message.edit( embed = _embedMessage.create("RemoveDueDate Reply", "Which stream is this for?\nOptions: " + ', '.join(_mongoFunctions.get_settings(ctx.guild.id)['streams']), "blue")) try: stream_message = await client.wait_for('message', timeout = wait_timeout, check = check) except asyncio.TimeoutError: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "You took too long to respond.", "red")) return else: stream = stream_message.content if stream not in _mongoFunctions.get_settings(ctx.guild.id)['streams']: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "The stream is invalid!", "red")) await asyncio.sleep(sleep_time) else: break while True: await response_message.edit( embed = _embedMessage.create("RemoveDueDate Reply", "What is the title?", "blue")) try: title_message = await client.wait_for('message', timeout = wait_timeout, check = check) except asyncio.TimeoutError: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "You took too long to respond.", "red")) return else: title = title_message.content break while True: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "What is the date? (YYYY MM DD)", "blue")) try: date_message = await client.wait_for('message', timeout = wait_timeout, check = check) except asyncio.TimeoutError: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "You took too long to respond.", "red")) return else: global error_check date = date_message.content.split(" ") if len(date) == 3: year = date[0] month = date[1] day = date[2] error_check = _dateFunctions.check_for_errors_in_date(year, month, day) else: error_check = 1 if error_check == 1: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "Invalid syntax. Make sure it is in the format YYYY MM DD", "red")) await asyncio.sleep(sleep_time) elif error_check == 2: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "The date is invalid, please ensure that this is a valid date.", "red")) await asyncio.sleep(sleep_time) else: date_object = datetime.date(int(year), int(month), int(day)) if date_object < datetime.date.today(): await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "That due date has already passed.", "red")) await asyncio.sleep(sleep_time) else: break while True: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "What time is the due date? (HH:MM)\nEnter 'None' if there is no time.", "blue")) try: time_message = await client.wait_for('message', timeout = wait_timeout, check = check) except asyncio.TimeoutError: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "You took too long to respond.", "red")) return else: time = time_message.content match = re.match('^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$', time) # Using regex to check if time format is valid if time == "None": break elif not match: await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "Invalid syntax. Make sure it is in the format HH:MM or 'None'", "red")) await asyncio.sleep(sleep_time) else: time = time.split(':') time_object = datetime.datetime(int(year), int(month), int(day), int(time[0]), int(time[1])) if time_object < datetime.datetime.now(): await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "That due date has already passed.", "red")) await asyncio.sleep(sleep_time) else: break if time == "None": if not _mongoFunctions.does_assignment_exist_already(ctx.guild.id, course, due_date_type, title, stream, datetime.datetime(int(year), int(month), int(day)), False): await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "Your due date does not exist!", "red")) return _mongoFunctions.remove_due_date_from_upcoming_due_dates(ctx.guild.id, course, due_date_type, title, stream, datetime.datetime(int(year), int(month), int(day)), False) await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "Your due date has been removed!", "blue")) else: if type(time) is str: time = time.split(':') if not _mongoFunctions.does_assignment_exist_already(ctx.guild.id, course, due_date_type, title, stream, datetime.datetime(int(year), int(month), int(day), int(time[0]), int(time[1])), True): await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "Your due date does not exist!", "red")) return _mongoFunctions.remove_due_date_from_upcoming_due_dates(ctx.guild.id, course, due_date_type, title, stream, datetime.datetime(int(year), int(month), int(day), int(time[0]), int(time[1])), True) await response_message.edit(embed = _embedMessage.create("RemoveDueDate Reply", "Your due date has been removed!", "blue")) await _dueDateMessage.edit_due_date_message(client)
async def help_command(ctx: discord.Message, client: discord.Client): commandPrefix2 = _mongoFunctions.get_settings(ctx.guild.id)['prefix'] help_embed = _embedMessage.create("General Commands", "Commands that can be run with BediBot. Each word represents an argument.", "green") _embedMessage.add_field(help_embed, commandPrefix2 + "help", "Allows you to view commands!", False) _embedMessage.add_field(help_embed, commandPrefix2 + "ping", "Returns Pong and some bot stats.", False) _embedMessage.add_field(help_embed, commandPrefix2 + "GitHub", "Shows the GitHub repository link", False) _embedMessage.add_field(help_embed, commandPrefix2 + "addquote \"quote with spaces\" Name", "Adds a quote from the individual of your choice\nEx: " + commandPrefix2 + "addquote \"Life is Good\" Bedi", False) _embedMessage.add_field(help_embed, commandPrefix2 + "getquotes person pagenumber", "Gets a persons quotes with a page number, with each page containing 5 quotes. Page number argument is optional.\nEx: " + commandPrefix2 + "getquotes Bedi 2", False) _embedMessage.add_field(help_embed, commandPrefix2 + "getrandomquote name", "Gets a random quote from a random or specified person. Name is optional.\nEx: " + commandPrefix2 + "getrandomquote Bedi", False) await ctx.channel.send(embed = help_embed) if _mongoFunctions.get_settings(ctx.guild.id)['verification_enabled']: verification_embed = _embedMessage.create("Verification Commands", "Commands related to verification.", "green") _embedMessage.add_field(verification_embed, commandPrefix2 + "verify userID{0}".format(_mongoFunctions.get_settings(ctx.guild.id)['email_domain']), "Allows you to verify yourself as a UWaterloo Student and access the server\nEx: " + commandPrefix2 + "verify g0ose{0}".format( _mongoFunctions.get_settings(ctx.guild.id)['email_domain']), False) _embedMessage.add_field(verification_embed, commandPrefix2 + "unverify", "Unverifies you from the server.", False) _embedMessage.add_field(verification_embed, commandPrefix2 + "confirm code", "Allows you to enter in your 2FA verification code after you run the verify command\nEx: " + commandPrefix2 + "confirm 123456789", False) await ctx.channel.send(embed = verification_embed) if _mongoFunctions.get_settings(ctx.guild.id)['birthday_announcements_enabled']: birthday_embed = _embedMessage.create("Birthday Commands", "Commands related to birthdays.", "green") _embedMessage.add_field(birthday_embed, commandPrefix2 + "getbirthdays monthnumber", "Gets all birthdays for the specified month\nEx: " + commandPrefix2 + "getbirthdays 5", False) _embedMessage.add_field(birthday_embed, commandPrefix2 + "setbirthday YYYY MM DD", "Allows you to set your birthday and let the server know when to embarrass you :D\nEx: " + commandPrefix2 + "setbirthday 2001 01 01", False) await ctx.channel.send(embed = birthday_embed) if _mongoFunctions.get_settings(ctx.guild.id)['due_dates_enabled']: due_date_embed = _embedMessage.create("Due Date Commands", "Commands related to due dates.", "green") _embedMessage.add_field(due_date_embed, commandPrefix2 + "addduedate", "Add's an assignment's due date to be counted down to\nEx: " + commandPrefix2 + "addduedate", False) await ctx.channel.send(embed = due_date_embed) if _checkrole.author_has_role(ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx): admin_embed = _embedMessage.create("Admin Commands", "Commands that can only be run by those with the admin role.", "green") _embedMessage.add_field(admin_embed, commandPrefix2 + "removequote \"quote with spaces\" Name", "Removes a quote from the individual of your choice\nEx: " + commandPrefix2 + "removequote \"Life is Good\" Bedi", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "adminverify @Mention", "Manually verifies a user.\nEx: " + commandPrefix2 + "adminverify " + client.user.mention, False) _embedMessage.add_field(admin_embed, commandPrefix2 + "purge number_of_messages", "Purges a specified amount of messages in the channel that the command is executed in.\nEx: " + commandPrefix2 + "purge 10", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "removeduedate", "Remove's a due date\nEx: " + commandPrefix2 + "removeduedate", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "lockdown role", "Sets send message permissions to false for specified role in the current channel." "If role is not specified. Channel will be locked for all possible roles.\nEx: " + commandPrefix2 + "lockdown " + "Tron", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "unlock role", "Sets send message permissions to True for specified role." "If role is not specified. Channel will be unlocked for all possible roles.\nEx: " + commandPrefix2 + "unlock " + "Tron", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "say title content channel", "Sends a message inside an embed to the specified channel\nEx: " + commandPrefix2 + "say Hello world " + ctx.channel.mention, False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setduedatechannel", "Sets the channel which will be used for due dates\n**WARNING**: This clears the channel's history. Use with caution.", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "settings", "Displays the guild's settings", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setup", "Command used to setup initial guild settings or change any settings.", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setupannouncement", "Command used to setup initial guild settings or change all settings at once.", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setupbirthdays", "Command used to setup birthday settings.", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setupduedates", "Command used to setup due date settings.", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setupquotes", "Command used to setup quote settings.", False) _embedMessage.add_field(admin_embed, commandPrefix2 + "setupverification", "Command used to setup verification settings.", False) await ctx.channel.send(embed = admin_embed)
async def settings(ctx: discord.Message, client: discord.Client): # Checks if user is admin or bot owner if not (_checkrole.author_has_role( ctx, _mongoFunctions.get_settings(ctx.guild.id)['admin_role']) or _util.author_is_bot_owner(ctx)): replyEmbed = _embedMessage.create("Settings Reply", "Invalid Permissions", "red") await ctx.channel.send(embed=replyEmbed) return settings_embed = _embedMessage.create( "Settings Reply", "Here are the settings for **" + ctx.guild.name + "**", "blue") _embedMessage.add_field( settings_embed, "Prefix", _mongoFunctions.get_settings(ctx.guild.id)['prefix'], False) _embedMessage.add_field( settings_embed, "Timezone", _mongoFunctions.get_settings(ctx.guild.id)['timezone'], False) _embedMessage.add_field( settings_embed, "Admin Role", _mongoFunctions.get_settings(ctx.guild.id)['admin_role'], False) _embedMessage.add_field( settings_embed, "Pins Enabled", _mongoFunctions.get_settings(ctx.guild.id)['pins_enabled'], False) await ctx.channel.send(embed=settings_embed) verification_embed = _embedMessage.create( "Verification Settings", "Here are the verification settings.", "blue") _embedMessage.add_field( verification_embed, "Verification Enabled?", _mongoFunctions.get_settings(ctx.guild.id)['verification_enabled'], False) if _mongoFunctions.get_settings(ctx.guild.id)['verification_enabled']: _embedMessage.add_field( verification_embed, "Verified Role", _mongoFunctions.get_settings(ctx.guild.id)['verified_role'], False) _embedMessage.add_field( verification_embed, "Verification Email Domain", _mongoFunctions.get_settings(ctx.guild.id)['email_domain'], False) await ctx.channel.send(embed=verification_embed) announcement_embed = _embedMessage.create( "Morning Announcement Settings", "Here are the morning announcement settings.", "blue") _embedMessage.add_field( announcement_embed, "Morning Announcements Enabled?", _mongoFunctions.get_settings( ctx.guild.id)['morning_announcements_enabled'], False) if _mongoFunctions.get_settings( ctx.guild.id)['morning_announcements_enabled']: try: channel_name = ctx.guild.get_channel( int( _mongoFunctions.get_settings( ctx.guild.id)['announcement_channel_id'])).mention except: channel_name = "Not set. Run {0}setup to set.".format( _mongoFunctions.get_settings(ctx.guild.id)['prefix']) _embedMessage.add_field(announcement_embed, "Morning Announcements Channel", channel_name, False) _embedMessage.add_field( announcement_embed, "Daily Announcement Time", _mongoFunctions.get_settings(ctx.guild.id)['announcement_time'], False) _embedMessage.add_field( announcement_embed, "Random Quote?", _mongoFunctions.get_settings(ctx.guild.id)['random_quote'], False) _embedMessage.add_field( announcement_embed, "Daily Announcement Quote Author", _mongoFunctions.get_settings( ctx.guild.id)['announcement_quoted_person'], False) await ctx.channel.send(embed=announcement_embed) birthday_embed = _embedMessage.create("Birthday Announcement Settings", "Here are the birthday settings.", "blue") _embedMessage.add_field( birthday_embed, "Birthday Announcements Enabled?", _mongoFunctions.get_settings( ctx.guild.id)['birthday_announcements_enabled'], False) if _mongoFunctions.get_settings( ctx.guild.id)['birthday_announcements_enabled']: try: channel_name = ctx.guild.get_channel( int( _mongoFunctions.get_settings( ctx.guild.id)['birthday_channel_id'])).mention except: channel_name = "Not set. Run {0}setup to set.".format( _mongoFunctions.get_settings(ctx.guild.id)['prefix']) _embedMessage.add_field(birthday_embed, "Birthday Announcements Channel", channel_name, False) _embedMessage.add_field( birthday_embed, "Birthday Announcement Time", _mongoFunctions.get_settings(ctx.guild.id)['birthday_time'], False) _embedMessage.add_field( birthday_embed, "Birthday Role", _mongoFunctions.get_settings(ctx.guild.id)['birthday_role'], False) await ctx.channel.send(embed=birthday_embed) due_date_embed = _embedMessage.create("Due Date Settings", "Here are the due date settings.", "blue") _embedMessage.add_field( due_date_embed, "Due Dates Enabled?", _mongoFunctions.get_settings(ctx.guild.id)['due_dates_enabled'], False) if _mongoFunctions.get_settings(ctx.guild.id)['due_dates_enabled']: try: channel_name = ctx.guild.get_channel( int( _mongoFunctions.get_settings( ctx.guild.id)['due_date_channel_id'])).mention except: channel_name = "Not set. Run {0}setduedatechannel in a channel to set.".format( _mongoFunctions.get_settings(ctx.guild.id)['prefix']) _embedMessage.add_field(due_date_embed, "Due Date Channel", channel_name, False) _embedMessage.add_field( due_date_embed, "Streams", ', '.join(_mongoFunctions.get_settings(ctx.guild.id)['streams']), False) _embedMessage.add_field( due_date_embed, "Courses", ', '.join(_mongoFunctions.get_settings(ctx.guild.id)['courses']), False) _embedMessage.add_field( due_date_embed, "Due Date Types", ', '.join( _mongoFunctions.get_settings(ctx.guild.id)['due_date_types']), False) await ctx.channel.send(embed=due_date_embed) quote_embed = _embedMessage.create("Quote Settings", "Here are the quote settings.", "blue") _embedMessage.add_field( quote_embed, "Quote Reaction Emoji Name", _mongoFunctions.get_settings(ctx.guild.id)['reaction_emoji'], False) _embedMessage.add_field( quote_embed, "Required Quote Reactions for Approval", _mongoFunctions.get_settings(ctx.guild.id)['required_quote_reactions'], False) await ctx.channel.send(embed=quote_embed)