Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from typing import TYPE_CHECKING
- import asyncio
- import os
- from glob import glob
- from disnake.ext.commands import *
- from disnake import Intents, Guild, Activity, ActivityType, Thread
- from disnake.abc import GuildChannel, PrivateChannel
- prefix = "&"
- OWNER_IDS = []
- COGS = [path.split("\\")[1][:-3] for path in glob("./lib/cogs/*py")]
- class Ready(object):
- def __init__(self):
- for cog in COGS:
- setattr(self, cog, False)
- def ready_up(self, cog):
- setattr(self, cog, True)
- print(f" {cog} ready")
- def all_ready(self):
- return all([getattr(self, cog) for cog in COGS])
- class Iteria(Bot):
- def __init__(self):
- self.prefix = prefix
- self.ready = False
- self.token = os.environ["bot_token2"]
- self.cogs_ready = Ready()
- self.version: str = ""
- self.intent = Intents.default()
- self.intent.messages = True
- super().__init__(command_prefix=self.prefix, owner_ids=OWNER_IDS, intents=self.intent)
- def run(self, version):
- self.version = version
- print("Running setup...")
- self.setup()
- print("running bot...")
- super().run(self.token, reconnect=True)
- def setup(self):
- for cog in COGS:
- try:
- print(f" loadin {cog}")
- self.load_extension(f"lib.cogs.{cog}")
- except NoEntryPointError as e:
- print(f" failed to load {cog}\nNo setup found\n")
- print(e)
- except ExtensionFailed as e:
- print(f" failed to load {cog}\nThe extension or its setup had an execution error\n")
- print(e)
- else:
- print(f" {cog} loaded")
- async def on_connect(self):
- print("bot connected")
- async def on_disconnect(self):
- print("bot disconnected")
Advertisement
Add Comment
Please, Sign In to add comment