-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbot.py
More file actions
36 lines (29 loc) · 913 Bytes
/
bot.py
File metadata and controls
36 lines (29 loc) · 913 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
import os
from src.utils import cleaned_message, get_message_id
from src.event_handlers import handle_reaction, handle_on_message
import discord
from src.database import pb
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
intents = discord.Intents.default()
intents.reactions = True
intents.messages = True
intents.members = True
intents.message_content = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f'{client.user} has connected to Discord!')
@client.event
async def on_message(message):
if message.author.bot:
return
await handle_on_message(message, client)
@client.event
async def on_reaction_add(reaction, user):
await handle_reaction('add', reaction, user, client)
@client.event
async def on_reaction_remove(reaction, user):
await handle_reaction('remove', reaction, user, client)
client.run(TOKEN)