-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (25 loc) · 689 Bytes
/
main.py
File metadata and controls
29 lines (25 loc) · 689 Bytes
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
from bot import bot
import os
from dotenv import load_dotenv
try:
with open('settings.csv', 'r') as file:
pass
except FileNotFoundError:
with open('settings.csv', 'w') as file:
pass
try:
with open('.env', 'r') as file:
pass
except FileNotFoundError:
raise FileNotFoundError("Please create a .env file with the DISCORD_TOKEN and other variables.")
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name}')
try:
synced = await bot.tree.sync()
print(f"Synced command(s): {len(synced)}")
except Exception as e:
print(e)
load_dotenv()
discord_token = os.getenv('DISCORD_TOKEN')
bot.run(discord_token)