-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
51 lines (39 loc) · 1.27 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# bot.py
import os
import subprocess
import discord
from discord.ext import commands
from dotenv import load_dotenv
intents = discord.Intents.default()
intents.members = True
intents.message_content = True
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
HOME_PATH = os.getenv('HOME_PATH')
DB_PATH = f'{HOME_PATH}gear_bot_db.db'
DEBUG = os.getenv('DEBUG')
version = subprocess.check_output(
["git", "describe", "--always"]).strip().decode()
description=f'BDOBot:\nAutomagically read GS from gear photos.\nv:{version}'
if DEBUG:
prefix = '~'
else:
prefix = '?'
owner_id = 152611107633233920
initial_extensions = ['cogs.fun', 'cogs.gear']
bot = commands.Bot(command_prefix=prefix, description=description, owner_id=owner_id, intents=intents)
@bot.event
async def on_ready():
for extension in initial_extensions:
try:
await bot.load_extension(extension)
except Exception as e:
print(f'Failed to load extension {extension}.')
print(e)
await bot.tree.sync()
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
for guild in bot.guilds:
print("{} : {}".format(guild.name, guild.id))
await bot.change_presence(activity=discord.Game('Black Spirit Notice Me!'))
print('------')
bot.run(TOKEN)