Skip to content

Commit

Permalink
Add meme - api
Browse files Browse the repository at this point in the history
  • Loading branch information
subba2048 committed Nov 11, 2024
1 parent 4b108b4 commit a5faa05
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import requests
import json

def get_meme():
response = requests.get('https://meme-api.com/gimme')
json_data = json.loads(response.text)
return json_data['url']

import discord
import os
from dotenv import load_dotenv

class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
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
Expand Down

0 comments on commit a5faa05

Please sign in to comment.