I get an error with my code, not sure how to fix it
im pretty new to disnake and python so still learning, sorry if its something obvious
@commands.slash_command(name="dog", description=" Display a random image of a Dog!")
async def dog(inter):
with open("images/dog.txt", "r") as f:
lines = f.readlines()
line = random.choice(lines)
image_link, description = line.strip().split("|")
with open("facts/dog.txt", "r") as f:
facts = f.readlines()
fact = random.choice(facts)
embed = disnake.Embed(colour=15660190)
embed.title = ("**Heres an image of a delightful dog!**")
embed.set_image(url=image_link)
embed.set_footer(text=fact)
embed.description = description
await inter.send(embed=embed)
print(f"User {inter.author.name} ({inter.author.id}) used command \"/dog\"")
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
