-
Notifications
You must be signed in to change notification settings - Fork 1
/
ROBOT.py
58 lines (42 loc) · 1.75 KB
/
ROBOT.py
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
51
52
53
54
55
56
57
58
import discord
from discord.ext import commands
import os
import auth
import asyncio
import config
from typing import TYPE_CHECKING
from coggers.variants import VariantCog
from coggers.parser import ParserCog
from coggers.data import DataCog
class Context(commands.Context): # taken from ric
silent: bool = False
async def send(self, content: str = "", embed: discord.Embed | None = None, **kwargs):
content = str(content)
if len(content) > 2000:
msg = " [...] \n\n (Character limit reached!)"
content = content[:2000 - len(msg)] + msg
if embed is not None:
if content:
return await super().send(content, embed=embed, **kwargs)
return await super().send(embed=embed, **kwargs)
elif content:
return await super().send(content, embed=embed, **kwargs)
return await super().send(**kwargs)
async def reply(self, *args, mention_author: bool = False, **kwargs):
kwargs['mention_author'] = mention_author
kwargs['reference'] = self.message
return await self.send(*args, **kwargs)
class Bot(commands.Bot):
parser: ParserCog
data: DataCog
variant_handler: VariantCog
def __init__(self, *args, cogs, **kwargs):
super().__init__(*args, **kwargs)
async def gather_cogs():
await asyncio.gather(*(self.load_extension(cog, package='ROBOT') for cog in cogs))
asyncio.run(gather_cogs())
print("Bot is running!")
intents = discord.Intents.default()
intents.message_content = True
bot = Bot(cogs=config.cogs, command_prefix=config.prefix, intents=intents, allowed_mentions=discord.AllowedMentions(everyone=False, roles=False, users=False),)
bot.run(auth.token, log_handler=None)