-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
32 lines (24 loc) · 885 Bytes
/
bot.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
import nextcord
import os
from nextcord.ext import commands
import config
def main():
# allows privledged intents for monitoring members joining, roles editing, and role assignments
# these need to be enabled in the developer portal as well
intents = nextcord.Intents.default()
intents.guilds = True
intents.members = True
intents.message_content = True
client = commands.Bot(config.BOT_PREFIX, intents=intents)
# Get the modules of all cogs whose directory structure is modules/<module_name>/cog.py
for folder in os.listdir("modules"):
if os.path.exists(os.path.join("modules", folder, "cog.py")):
client.load_extension(f"modules.{folder}.cog")
@client.event
async def on_ready():
"""When discord is connected"""
print(f"{client.user.name} has connected to Discord!")
# Run Discord bot
client.run(config.DISCORD_TOKEN)
if __name__ == "__main__":
main()