0

I'm trying to get my basic discord bot to display a GIF using python as if a user was sending it from tenor.
I.E: example gif
I managed to get my bot to send a gif file that can be opened and viewed but I want to take it a step further and have it show the gif in chat.
Example

import discord
import io
import aiohttp

client = discord.Client()
@client.event
async def on_ready():
  print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
  if message.author == client.user:
    return
  if message.content == 'hello':
    embed = discord.Embed(title="Title", description="Desc", color=0x00ff00) #creates embed
    file = discord.File("toodamnbad.gif", filename="image.png")
    embed.set_image(url="attachment://image.png")
    await message.channel.send(file=file)
    
client.run('TOKEN')
inkutema
  • 1
  • 3

1 Answers1

0
import discord
from discord.ext import commands
from discord.ext.commands import Bot

import json
import random

bot = commands.Bot(command_prefix="!", case_insensitive=True)
bot.remove_command('help')
@bot.event
async def on_ready():
    print("Asuna")
@bot.command(case_insensitive=True)
async def command(ctx, member: discord.Member): # which command it responds to.
    image = random.choice(["url", "url", "url"])
    embed = discord.Embed(color = 0x303136, description = "text")
    embed.set_image(url=image)
    await ctx.send(embed=embed)

random gif↑ 1 gif ↓

import discord
from discord.ext import commands
from discord.ext.commands import Bot

import json

bot = commands.Bot(command_prefix="!", case_insensitive=True)
bot.remove_command('help')
@bot.event
async def on_ready():
    print("Asuna")
@bot.command(pass_context=True)
async def reactions(cxt):
    embed = discord.Embed(color = 0x303136, description = "text")
    embed.set_image(url='url')
    await cxt.send(embed = embed)
Yuki_snow
  • 1
  • 1