-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
63 lines (43 loc) · 1.38 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import json
import nextcord
from nextcord.ext import commands as nextcordcommands
import module_manager
import logging
import data_manager
import mafic
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
logging.getLogger("nextcord.client").setLevel(logging.WARNING)
logging.basicConfig(format='[%(levelname)s - %(name)s] %(asctime)s - %(message)s')
print("launching bot...")
f = open("config/setup.json", "r")
config = json.load(f)
TOKEN = config["token"]
WAVELINK_KEY = config["wavelink_key"]
WAVELINK_IP = config["wavelink_ip"]
f.close()
intents = nextcord.Intents.default()
intents.members = True
intents.guild_messages = True
intents.messages = True
intents.guilds = True
class bot(nextcordcommands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.pool = mafic.NodePool(self)
self.loop.create_task(self.add_nodes())
async def add_nodes(self):
await self.pool.create_node(
host=WAVELINK_IP,
port=2333,
label="MAIN",
password=WAVELINK_KEY,
)
client = bot(intents=intents)
module_manager.load_modules("commands", client)
module_manager.load_modules("events", client)
@client.event
async def on_ready():
print("ready {0.user}".format(client))
data_manager.init_guild_config([guild.id for guild in client.guilds])
client.run(TOKEN)