-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (26 loc) · 923 Bytes
/
main.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
import asyncio
import os
import re
import aiohttp
import dotenv
import revolt
from revolt.ext import commands
dotenv.load_dotenv()
class JDBot(commands.CommandsClient):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.prefixless = False
async def get_prefix(self, message: revolt.Message):
extras = ["test*", "te*", "t*", "jdbot.", "jd.", "test.", "te."]
comp = re.compile("^(" + "|".join(map(re.escape, extras)) + ").*", flags=re.I)
match = comp.match(message.content)
if match is not None:
extras.append(match.group(1))
if await self.is_owner(message.author) and self.prefixless:
extras.append("")
return extras
async def main():
async with aiohttp.ClientSession() as session:
bot = JDBot(session, os.environ["TOKEN"])
await bot.start()
asyncio.run(main())