This repository was archived by the owner on Sep 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
54 lines (47 loc) · 1.58 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
import os
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from dotenv import load_dotenv
class ExpandBot(commands.Bot):
def __init__(self, command_prefix):
allowed_mentions = discord.AllowedMentions(
everyone=False, roles=False, users=True
)
intents = discord.Intents.all()
super().__init__(
command_prefix=command_prefix,
intents=intents,
allowed_mentions=allowed_mentions,
)
self.set_vars()
print("loaded")
def set_vars(self):
self.ready = False
self.slash_client = SlashCommand(self, sync_commands=True)
self.log_ch_id = int(os.environ["LOG_CH_ID"])
self.cog_folders = [
"management",
"commands",
"core",
]
async def on_ready(self):
if self.ready:
return
self.ready = True
for folder in self.cog_folders:
for cog in os.listdir(f"./{folder}"):
if cog == "__pycache__":
continue
try:
self.load_extension(f"{folder}.{cog[:-3]}")
except discord.ext.commands.errors.ExtensionFailed:
continue
await self.change_presence(
activity=discord.Game(name=f"/ヘルプ | {len(self.guilds)}サーバー")
)
print("ready")
if __name__ == "__main__":
load_dotenv()
bot = ExpandBot(command_prefix="e:")
bot.run(os.environ["TOKEN"])