bugfixes regarding logging, api and db working; small fixes in all of the cogs; moved all the configurable information to the config.py
This commit is contained in:
45
main.py
45
main.py
@@ -13,13 +13,25 @@ logging.basicConfig(
|
||||
]
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
intents.reactions = True
|
||||
intents.members = True
|
||||
intents.guilds = True
|
||||
intents.messages = True
|
||||
intents.voice_states = True
|
||||
|
||||
COGS = [
|
||||
#! cogs to load
|
||||
'cogs.role_manager',
|
||||
'cogs.status_rotator',
|
||||
'cogs.funchosa_parser',
|
||||
'cogs.uptime',
|
||||
'cogs.help',
|
||||
'cogs.kitty',
|
||||
]
|
||||
|
||||
|
||||
class Bot(commands.Bot):
|
||||
def __init__(self):
|
||||
@@ -28,30 +40,27 @@ class Bot(commands.Bot):
|
||||
intents=intents,
|
||||
help_command=None,
|
||||
)
|
||||
|
||||
|
||||
async def setup_hook(self):
|
||||
# ! load cogs
|
||||
await self.load_extension('cogs.role_manager')
|
||||
await self.load_extension('cogs.status_rotator')
|
||||
await self.load_extension('cogs.funchosa_parser')
|
||||
await self.load_extension('cogs.uptime')
|
||||
await self.load_extension('cogs.help')
|
||||
await self.load_extension('cogs.kitty')
|
||||
#await self.load_extension('cogs.muter') # ass
|
||||
# adding new modules:
|
||||
# await self.load_extension('cogs.whyrureadingts')
|
||||
|
||||
for cog in COGS:
|
||||
try:
|
||||
await self.load_extension(cog)
|
||||
logger.info("Loaded cog: %s", cog)
|
||||
except Exception as e:
|
||||
logger.error("Failed to load cog %s: %s", cog, e, exc_info=True)
|
||||
|
||||
await self.tree.sync()
|
||||
|
||||
|
||||
async def on_ready(self):
|
||||
print(f"bot initialized succesfully with user '{self.user}'")
|
||||
print(f"user.id: '{self.user.id}'")
|
||||
print('initialization (probably) complete; further is logs.')
|
||||
print('\n*------*\n')
|
||||
if not hasattr(self, '_ready'):
|
||||
self._ready = True
|
||||
logger.info("Bot ready: %s (id: %s)", self.user, self.user.id)
|
||||
|
||||
|
||||
async def main():
|
||||
bot = Bot()
|
||||
await bot.start(config.TOKEN)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user