Added nice formatting for ~doggo breeds

Added more commentary
pull/2/head
sgoudham 4 years ago
parent 82dd7a164d
commit 7af80eb352

@ -272,9 +272,14 @@ class Fun(commands.Cog):
for doggo in breed_link: for doggo in breed_link:
b_list.append(doggo) b_list.append(doggo)
# Define a new string to store the Doggo's nicely formatted
string = " "
for b in b_list:
string += (b + ", ").capitalize()
# Tell the user to try the breeds listed below # Tell the user to try the breeds listed below
await ctx.send(f"Try the Breeds listed below!" + await ctx.send(f"Try the Breeds listed below!" +
f"\n {b_list}") f"\n {string}")
# If no breed has been specified # If no breed has been specified
else: else:
@ -304,16 +309,18 @@ class Fun(commands.Cog):
# Send error message that Doggo was not found! # Send error message that Doggo was not found!
await ctx.send( await ctx.send(
"Doggo Not Found! Please do **~doggo breeds** to see the full list of Doggos!") "Doggo Not Found! Please do **~doggo breeds** to see the full list of Doggos!")
else: else:
# Grab a random image of a doggo of any breed
image_url = "https://dog.ceo/api/breeds/image/random" image_url = "https://dog.ceo/api/breeds/image/random"
# Using API, retrieve the image of a doggo of any breed
async with request("GET", image_url, headers={}) as response: async with request("GET", image_url, headers={}) as response:
if response.status == 200: if response.status == 200:
data = await response.json() data = await response.json()
image_link = data["message"] image_link = data["message"]
# Set up the embed for a random waifu image # Set up the embed for a random doggo image
doggo_embed = discord.Embed( doggo_embed = discord.Embed(
title=f"**Doggo!!** ", title=f"**Doggo!!** ",
colour=discord.Colour(random.choice(settings.colour_list))) colour=discord.Colour(random.choice(settings.colour_list)))
@ -321,12 +328,16 @@ class Fun(commands.Cog):
doggo_embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) doggo_embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
doggo_embed.timestamp = datetime.datetime.utcnow() doggo_embed.timestamp = datetime.datetime.utcnow()
# Send random doggo image to the channel
await ctx.send(embed=doggo_embed) await ctx.send(embed=doggo_embed)
else: else:
await ctx.send("Response Timed Out!")
# Send error message that Doggo was not found!
await ctx.send(
"Doggo Not Found! Please do **~doggo breeds** to see the full list of Doggos!")
else: else:
# Call error_function() and display it to the user # Call error_function() and display it to the user
message = await ctx.send(error_function()) message = await ctx.send(error_function())

Loading…
Cancel
Save