diff --git a/EnsoBot.py b/EnsoBot.py index 88a86502..27edf2d4 100644 --- a/EnsoBot.py +++ b/EnsoBot.py @@ -107,7 +107,8 @@ async def on_member_join(member): await new_people.send(embed=embed) - general_welcome = f"Welcome to the server! {member.mention} I hope you enjoy your stay here. Please go into <#722347423913213992> to choose some ping-able roles for events!" + general_welcome = f"Welcome to the server! {member.mention} I hope you enjoy your stay here. Please go into " \ + f"<#722347423913213992> to choose some ping-able roles for events! " await general.send(general_welcome) except Exception as e: diff --git a/cogs/WaifuImages.py b/cogs/WaifuImages.py index 5ddeffeb..1f3e0ed5 100644 --- a/cogs/WaifuImages.py +++ b/cogs/WaifuImages.py @@ -1,7 +1,6 @@ import asyncio import datetime import random -import string import discord from discord.ext import commands @@ -124,25 +123,18 @@ class Waifus(commands.Cog): 'gria', 'lilu', 'marcus', 'eric', 'ifrah', 'janet', 'connor', 'taz', 'ryder', 'clarity'] - proper_name = name.lower() - if name: + proper_name = name.lower() try: with open(f'images/ServerMembers/{proper_name}.txt') as file: images_array = file.readlines() embed = displayServerImage(images_array, ctx, proper_name) await ctx.send(embed=embed) + except Exception as e: print(e) - - await ctx.send(f"Sorry! That person doesn't exist!! Try the names listed below!") - - nice = string.capwords(', '.join(map(str, array))) - await ctx.send(nice) - else: - with open(f'images/ServerMembers/{random.choice(array)}.txt') as file: array = file.readlines() @@ -152,7 +144,7 @@ class Waifus(commands.Cog): userAvatar = member.avatar_url embed = discord.Embed( - title=f"**Oh Look! A Cute Person **", + title=f"Oh Look! A Cute Person ", colour=discord.Colour(random.choice(colour_list))) embed.set_image(url=random.choice(array)) embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) @@ -162,30 +154,18 @@ class Waifus(commands.Cog): def displayServerImage(array, ctx, name): if str(ctx.channel) in channels: - if name == 'studentjon': - # set member as the author - member = ctx.message.author - userAvatar = member.avatar_url - - embed = discord.Embed( - title=f"**Oh Look! A Cute Picture of Student Jon!! **", - colour=discord.Colour(random.choice(colour_list))) - embed.set_image(url=random.choice(array)) - embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) - embed.timestamp = datetime.datetime.utcnow() - else: - # set member as the author - member = ctx.message.author - userAvatar = member.avatar_url - - embed = discord.Embed( - title=f"**Oh Look! A Cute Picture of {name.capitalize()}!! **", - colour=discord.Colour(random.choice(colour_list))) - embed.set_image(url=random.choice(array)) - embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) - embed.timestamp = datetime.datetime.utcnow() - - return embed + # set member as the author + member = ctx.message.author + userAvatar = member.avatar_url + + embed = discord.Embed( + title=f"**Oh Look! A Cute Picture of {name.capitalize()}!! **", + colour=discord.Colour(random.choice(colour_list))) + embed.set_image(url=random.choice(array)) + embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) + embed.timestamp = datetime.datetime.utcnow() + + return embed # Error handling function to make sure that the commands only work in bot-commands