Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save miditkl/58b78b8304a835e6d9d471c067b4b0df to your computer and use it in GitHub Desktop.
Save miditkl/58b78b8304a835e6d9d471c067b4b0df to your computer and use it in GitHub Desktop.
import discord
from discord.ext import commands
import tenorpy
bot = commands.Bot(command_prefix='!')
t = tenorpy.Tenor()
@commands.command()
async def gif(ctx, giftag):
"""This command will return a tenor gif if you type "!gif cat" as example."""
getgifurl = t.random(str(giftag))
await ctx.send(f'{getgifurl}')
@gif.error
async def gif_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Giftag cant be None. Please give a valid giftag to search.')
bot.run('BOT_TOKEN')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment