Using python-pixabay I am trying to search for otter images, then get my discord.py bot to send the image in an embed. After I search for the image and get the image, then I print it out, but it doesn't print anything, so I am pretty sure it's a problem with the image search. I get no error messages, but it just won't work.
Here is my code:
import pixabay
import discord
pixa = os.getenv('PIXABAY_KEY')
image = Image(pixa)
@bot.command(name='otter', help='Generates a random otter!')
async def otter(ctx):
page = random.choice(range(0, 4))
embed = discord.Embed(title='Otter', color=discord.Color.from_rgb)
embed.set_image(url=ims)
embed.set_footer(text='Powered by pixabay.')
await ctx.send(embed=embed)
bot.run(TOKEN)
I didn't show all my code because there is some sensitive stuff in there, but I showed all the things you need to see. Pixabay is definitely installed, as I installed it via the instructions on the PyPi website
One thing I'm noticing is that the description is empty. Often, embeds won't send if they have empty fields, so I'd recommend checking you at least plop in a
\u200b(empty character)* or text of some description.Additionally, the
colorparameter doesn't seem to actually have a value.discord.Color.from_rgb()is actually a method which takes in 3 integer values between 0-255 (#FFFFFF, #000000 not allowed).As a side note, you can use this website to get hex codes for the colours instead.
Example:
*
description="\u200b"