Reusing code by making functions

Increased modularity
pull/4/head
sgoudham 4 years ago
parent 1392c1b8cf
commit 355bf901b0

@ -1,5 +1,4 @@
import asyncio import asyncio
import datetime
import random import random
from aiohttp import request from aiohttp import request
@ -9,6 +8,7 @@ from discord.ext.commands import BucketType, cooldown, command, has_any_role, is
import settings import settings
from cogs.anime.interactive import error_function from cogs.anime.interactive import error_function
from settings import time, colour_list
# Set up the cog # Set up the cog
@ -170,8 +170,8 @@ class Fun(commands.Cog):
# Set up the embed to display a random image of digby # Set up the embed to display a random image of digby
embed = Embed( embed = Embed(
title=f"**A cute picture of Digby!**", title=f"**A cute picture of Digby!**",
colour=Colour(int(random.choice(settings.colour_list))), colour=Colour(int(random.choice(colour_list))),
timestamp=datetime.datetime.utcnow()) timestamp=time)
embed.set_image(url=random.choice(digby_array)) embed.set_image(url=random.choice(digby_array))
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
@ -241,8 +241,8 @@ class Fun(commands.Cog):
# Set up the embed for a doggo image # Set up the embed for a doggo image
doggo_embed = Embed( doggo_embed = Embed(
title=f"**It's a {lowercase_breed.capitalize()} Doggo!!** ", title=f"**It's a {lowercase_breed.capitalize()} Doggo!!** ",
colour=Colour(random.choice(settings.colour_list)), colour=Colour(random.choice(colour_list)),
timestamp=datetime.datetime.utcnow()) timestamp=time)
doggo_embed.set_image(url=image_link) doggo_embed.set_image(url=image_link)
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))
@ -268,8 +268,8 @@ class Fun(commands.Cog):
# Set up the embed for a random doggo image # Set up the embed for a random doggo image
doggo_embed = Embed( doggo_embed = Embed(
title=f"**Doggo!!** ", title=f"**Doggo!!** ",
colour=Colour(random.choice(settings.colour_list)), colour=Colour(random.choice(colour_list)),
timestamp=datetime.datetime.utcnow()) timestamp=time)
doggo_embed.set_image(url=image_link) doggo_embed.set_image(url=image_link)
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))

Loading…
Cancel
Save