I've been trying every bit of code I find that might work but either the command doesn't load (it says the bot is typing and then stops) or just the bot itself doesn't work. I'm using Python.
Let's face it, everyone loves Nitro for the emotes and avatars. But let bots have . gifs for avatars as well! Maybe only one bot can have it, but that's one of the coolest features on Discord!
Normally you can just send the url of the discord image and discord will do it. If it local however, https://stackoverflow.com/questions/52241051/i-want-to-let-my-discord-bot-send-images-gifs 5 months ago
You’ll see the GIF icon hanging out with the emoji picker in your text channels. By clicking on the GIF icon, you’ll find a variety of categories. All that much more accessible for your GIF needs. You can also use the search bar at the top to really capture your emotions. Note: Make sure you've updated your Discord app fully on your mobile device!
Here we'll focus on two different methods of uploading images and other embedded media into a Discord text channel. The first way to upload an image into Discord is that simple- Just drag an image or GIF from another source and drop it into the Discord window.
Did you know, you can search for and post GIFs directly on the Discord app? Let us assist you with sending GIFs to your friends in a snap! No more hunting around folders or websites! First things first - you can only send gifs, not jif. What does this Article Cover? It’s super simple!
I know your problem is already solved, but I will post an answer so that people who have this same problem will be able to find the solution easily.
To send an image or GIF, here are two options (adapted from here):
Opening the file and sending it directly to the channel:
with open('my_image.png', 'rb') as f:
picture = discord.File(f)
await channel.send(file=picture)
Passing the file name directly:
await channel.send(file=discord.File('my_image.png'))
Here are some useful links:
discord.py
docsdiscord.py
FAQdiscord.py
GitHub repositorydiscord.py
GitHub postAlternatively, you can use URLs for images/gifs by adding the link as a standard message to be sent by your bot.
async def _cowgif(self, ctx):
await ctx.send("http://imgur.com/gallery/YiMUiop")
Note that this is an asynchronous request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With