initial push
This commit is contained in:
97
disc_havoc.py
Normal file
97
disc_havoc.py
Normal file
@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python3.12
|
||||
# pylint: disable=bare-except, invalid-name, import-outside-toplevel
|
||||
|
||||
import os
|
||||
import logging
|
||||
import importlib
|
||||
import discord
|
||||
import setproctitle
|
||||
import hypercorn
|
||||
import hypercorn.asyncio
|
||||
from dotenv import load_dotenv
|
||||
from discord.ext import bridge, commands
|
||||
from termcolor import colored
|
||||
import api
|
||||
|
||||
logging.basicConfig(level=logging.INFO,
|
||||
format='%(asctime)s %(message)s',
|
||||
encoding='utf-8')
|
||||
setproctitle.setproctitle('disc-havoc')
|
||||
|
||||
owners = [1172340700663255091, 992437729927376996]
|
||||
BOT_CHANIDS = [
|
||||
1145182936442875997,
|
||||
1157535700774834236,
|
||||
1156710277266542624,
|
||||
1179232748385341530,
|
||||
1219638300654964807,
|
||||
1193632849740439665,
|
||||
1202288798315335831,
|
||||
1157529874936909934,
|
||||
1272333206066167959,
|
||||
1228740577068322839,
|
||||
1228740577068322841,
|
||||
1324142398741151784,
|
||||
]
|
||||
|
||||
cogs_list = [
|
||||
'misc',
|
||||
'owner',
|
||||
'sing',
|
||||
'meme',
|
||||
'ai',
|
||||
'karma',
|
||||
'lovehate',
|
||||
'quote',
|
||||
'radio',
|
||||
]
|
||||
|
||||
bot_activity = discord.CustomActivity(name="I made cookies!")
|
||||
|
||||
load_dotenv()
|
||||
|
||||
intents = discord.Intents.all()
|
||||
intents.message_content = True
|
||||
bot = bridge.Bot(command_prefix=".", intents=intents,
|
||||
owner_ids=owners, activity=bot_activity,
|
||||
help_command=commands.MinimalHelpCommand())
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
"""Run on Bot Ready"""
|
||||
logging.info("%s online!", bot.user)
|
||||
|
||||
def load_exts(initialRun=True):
|
||||
"""Load Cogs/Extensions"""
|
||||
load_method = bot.load_extension if initialRun else bot.reload_extension
|
||||
|
||||
for cog in cogs_list:
|
||||
logging.info("Loading: %s", cog)
|
||||
load_method(f'cogs.{cog}')
|
||||
|
||||
# asyncio.get_event_loop().create_task(bot.sync_commands())
|
||||
|
||||
importlib.reload(api)
|
||||
from api import API # pylint: disable=unused-import
|
||||
api_config = hypercorn.config.Config()
|
||||
api_config.bind = "10.10.10.100:5992"
|
||||
api_instance = api.API(bot)
|
||||
try:
|
||||
bot.fapi_task.cancel()
|
||||
except:
|
||||
pass
|
||||
|
||||
logging.info("Starting FAPI Task")
|
||||
|
||||
bot.fapi_task = bot.loop.create_task(hypercorn.asyncio.serve(api_instance.api_app, api_config))
|
||||
|
||||
def __init__():
|
||||
logging.info(colored(f"Log level: {logging.getLevelName(logging.root.level)}", "red", attrs=['reverse']))
|
||||
bot.BOT_CHANIDS = BOT_CHANIDS
|
||||
bot.load_exts = load_exts
|
||||
bot.load_exts()
|
||||
bot.run(os.getenv('TOKEN'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
__init__()
|
Reference in New Issue
Block a user