-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
58 lines (47 loc) · 1.6 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#i have no idea what im doing.
#nvm i kinda do
import discord
from discord.ext import commands
import json
from typing import Dict
import asyncio
import json
import os
import nest_asyncio
import stuff.customHelp as ch
import logging
from discord import app_commands
intents = discord.Intents.all()
nest_asyncio.apply()
tokenjson = {}
with open("token.json") as token:
tokenjson = json.loads(token.read())
bot = commands.Bot(command_prefix=tokenjson["prefix"], case_insensitive=True, intents=intents, description="A random bot", help_command=ch.HelpCommand(), tree_cls=app_commands.tree.CommandTree)
bot.activity = discord.Game(name=tokenjson["playing_status"])
@bot.event
async def on_ready():
print("Logged in as " + str(bot.user))
try:
await bot.tree.sync()
print("Synced")
except Exception as e:
print(e)
#@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send('Pass in all arguments, please.')
elif isinstance(error, commands.MissingPermissions):
await ctx.send("You're missing permissions to run this command.")
else:
await ctx.send("Internal error. Please report to bot developer @klavg.")
print(error)
token = tokenjson["token"]
async def load():
for filename in os.listdir("./cogs"):
if filename.endswith(".py"):
await bot.load_extension(f"cogs.{filename[:-3]}")
async def fuckthisshit():
await load()
#await bot.run(token, log_handler=logging.StreamHandler(), log_level=logging.DEBUG)
bot.run(token)
asyncio.run(fuckthisshit())