-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot_without_token.py
More file actions
42 lines (29 loc) · 862 Bytes
/
bot_without_token.py
File metadata and controls
42 lines (29 loc) · 862 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 29 21:14:14 2025
@author: Dashka
"""
import discord
import os
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.messages = True
client = MyClient(intents=intents)
TOKEN = 'here should be token'
if TOKEN:
client.run(TOKEN)
else:
print("Ошибка: Токен не найден.")