-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient.py
54 lines (41 loc) · 1.17 KB
/
client.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
# discord api
import discord
from discord.ext import commands
# .env configuration
from dotenv import load_dotenv
load_dotenv()
# system
import psutil
import os
# custom utilities and setup
from Utilities import db, log
log = log.Logger("client")
# client runtime variable
Token = os.getenv("CLIENT_TOKEN")
class Client(commands.AutoShardedBot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# client version
self.Version = "0.1.0"
# operational level variables
self.Updating = False
self.Debugging = False
self.Maintaining = False
# psutil utilization
self.process = psutil.Process(os.getpid())
@commands.Cog.listener()
async def on_ready(self):
await log.info(f"{self.user} is online.")
await db.build()
# calling and initializing the client
client = Client(
commands.when_mentioned_or("."),
intents=discord.Intents.all(),
case_insensitive=True,
help_command=None
)
# Load cogs
for filename in os.listdir("./Cogs"):
if filename.endswith(".py"):
client.load_extension(f"Cogs.{filename[:-3]}")
client.run(Token, reconnect=True)