-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
25 lines (19 loc) · 636 Bytes
/
bot.py
File metadata and controls
25 lines (19 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import discord
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']
class MyClient(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 = MyClient(intents=intents)
client.run('') # Token