Skip to content

Instantly share code, notes, and snippets.

@colebob9
Created January 17, 2018 03:50
Show Gist options
  • Save colebob9/4febfda84bf93481580d384eebccb154 to your computer and use it in GitHub Desktop.
Save colebob9/4febfda84bf93481580d384eebccb154 to your computer and use it in GitHub Desktop.
Replies to every message on a Discord server with a GIF with varying results
# GiphyBot v0.1
# colebob9
# Python3
import discord
import asyncio
from giphypop import translate
client = discord.Client()
@client.event
async def on_ready():
print('------')
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
if message.author == client.user:
pass
else:
print("")
print("%s sent: " % message.author)
print(message.content)
img = translate(message.content, api_key='GIPHY-KEY')
msg = img.url
print("Replying with: ")
print(msg)
await client.send_message(message.channel, msg)
client.run('DISCORD-KEY')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment