-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (27 loc) · 991 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
import discord
from discord.ext import commands
from decouple import config
from datetime import datetime
import os
extdir = "extensions" # Name of the directory in which all the extensions files go
prefix = ['?', '? '] # Prefix(s) of the bot
intents = discord.Intents.all() # Intents of the bot
client = commands.Bot(
command_prefix=prefix,
intents=intents,
case_insensitive=True
)
# Loads all extensions at start
for filename in os.listdir(extdir):
if filename.endswith(".py"):
try:
extname = f"extensions.{filename[:-3]}"
client.load_extension(extname)
print(f" * '{extname}' has been loaded")
except Exception as e: print(e)
@client.event
async def on_ready():
# Displays once the bot has successfully been started
print(f'\n * Logged in as {client.user.name}#{client.user.discriminator} \n * Time: {datetime.now()}')
# Starts the bot
client.run(config("token"))