Skip to content

Instantly share code, notes, and snippets.

@karim-eg
Created July 5, 2024 20:31
Show Gist options
  • Save karim-eg/e3d6f3e50742e945c1a4afb01aa6928e to your computer and use it in GitHub Desktop.
Save karim-eg/e3d6f3e50742e945c1a4afb01aa6928e to your computer and use it in GitHub Desktop.
Discord Bot For Memes
"""
Made By Karim Abdallah, Android Engineer.
contact: karim@kotect.com
website: https://kotect.com
"""
import json
import discord
import requests
bot_token = "YOUR_TOKEN_HERE"
def get_meme():
response = requests.get('https://meme-api.com/gimme')
json_data = json.loads(response.text)
return json_data['url']
class BotClient(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
if message.author == self.user:
return
if message.content.startswith('/meme'):
await message.channel.send(get_meme())
intents = discord.Intents.default()
intents.message_content = True
client = BotClient(intents=intents)
client.run(bot_token)
@karim-eg
Copy link
Author

karim-eg commented Jul 5, 2024

Result:
Screenshot 2024-07-05 232913

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment