67 lines
1.6 KiB
Python
67 lines
1.6 KiB
Python
from commands import help, ticket
|
|
|
|
# pip install imports
|
|
import discord, aiofiles
|
|
from discord.ext import commands
|
|
|
|
from dotenv import load_dotenv
|
|
import asyncio
|
|
import pymongo
|
|
|
|
# sys imports
|
|
import os
|
|
|
|
load_dotenv()
|
|
|
|
import sentry_sdk
|
|
sentry_sdk.init(
|
|
dsn=os.getenv("key"),
|
|
|
|
# Set traces_sample_rate to 1.0 to capture 100%
|
|
# of transactions for performance monitoring.
|
|
# We recommend adjusting this value in production.
|
|
traces_sample_rate=1.0
|
|
)
|
|
|
|
# startup stuff
|
|
load_dotenv()
|
|
|
|
intents = discord.Intents().default()
|
|
intents.message_content = True
|
|
intents.guilds = True
|
|
intents.members = True
|
|
|
|
# create the bot
|
|
class MyBot(commands.Bot):
|
|
def __init__(self):
|
|
super().__init__(command_prefix="!", intents = intents)
|
|
self.synced = False
|
|
self.warnings = {}
|
|
self.remove_command("help")
|
|
|
|
async def setup_hook(self):
|
|
self.add_view(help.SelectView())
|
|
self.add_view(ticket.CreateButton())
|
|
self.add_view(ticket.CloseButton())
|
|
self.add_view(ticket.TrashButton())
|
|
print(f'\33[32mLogged in as {self.user} (ID: {self.user.id})')
|
|
print('------')
|
|
|
|
async def load_extensions(self):
|
|
for name in os.listdir('./commands'):
|
|
if name.endswith('.py'):
|
|
await self.load_extension(f'commands.{name[:-3]}')
|
|
|
|
# making var for commands in this file
|
|
bot = MyBot()
|
|
|
|
# start bot
|
|
async def main():
|
|
async with bot:
|
|
await bot.load_extensions()
|
|
await bot.start(os.getenv("token"))
|
|
await asyncio.sleep(0.1)
|
|
await asyncio.sleep(0.1)
|
|
|
|
asyncio.run(main())
|