-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (35 loc) · 1.42 KB
/
main.py
File metadata and controls
50 lines (35 loc) · 1.42 KB
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
43
44
45
46
47
48
49
50
import discord
from discord.ext import commands
from config import config
import utils
import plugin
from plugins.roles import Roles
from plugins.userinfo import UserEvent
import asyncio
import traceback
class KBot(commands.Bot):
async def on_ready(self):
print('Logged on as', self.user)
asyncio.create_task(Roles().daemon(self))
async def on_message(self, message: discord.Message):
if message.author == self.user:
return
msg = utils.Msg()
msg.parse_msg(message)
msg.client = self
msg.parse_command()
if msg.skip: return
if msg.is_command:
if msg.user.perm < plugin.plugins_map[msg.command].perm:
await msg.sendMessage("У вас не достаточно прав для этой команды")
return
await plugin.plugins_map[msg.command].execute(msg)
await UserEvent().execute(msg)
await message.delete()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
await plugin.plugins_map["роль"].reaction(self, payload)
async def on_raw_reaction_remove(self, payload: discord.RawReactionActionEvent):
await plugin.plugins_map["роль"].reaction(self, payload, add=False)
intents = discord.Intents.all()
client = KBot(command_prefix="", intents=intents)
client.run(config.discord_token)