From e0a5c9cc0b7c453a330c911f872550c0152ae082 Mon Sep 17 00:00:00 2001 From: C <0xicl33n@gmail.com> Date: Tue, 1 Apr 2025 12:32:44 -0700 Subject: [PATCH] oh wow that was easy to fix actually --- .gitignore | 1 + bot.py | 14 +++++++------- lib/checks.py | 9 --------- lib/mod.py | 4 ++-- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 7cfbfbf..67a12fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .env *.pyc *.pyd +*__pycache__/ poetry.lock \ No newline at end of file diff --git a/bot.py b/bot.py index 97cf68e..b41ca4f 100644 --- a/bot.py +++ b/bot.py @@ -29,6 +29,7 @@ libs = [ "lib.mod", ] + def get_prefix(bot, message): prefixes = ["?"] @@ -40,18 +41,17 @@ class Bot(commands.Bot): async def on_ready(self): for lib in libs: try: - bot.load_extension(lib) + await bot.load_extension(lib) except Exception as e: - print(f'[!] Failed to load extension: {lib}') + print(f"[!] Failed to load extension: {lib}") traceback.print_exc() - finally: - print(f"\n[^] Loaded {len(libs)} extensions loaded successfully.") + print(f"\n[^] Loaded {len(libs)} extensions loaded successfully.") # for guild in bot.guilds: # await bot.tree.sync(guild=discord.Object(id=guild.id)) # print(f"[^] Sync'd application commands to {len(bot.guilds)} servers") - print(f"[*] Logged in as {bot.user} (ID: {bot.user.id})") + print(f"[*] I am {bot.user} (ID: {bot.user.id})") game = discord.Game(name="https://traps.moe", activity=random.randint(0, 3)) await bot.change_presence(status=discord.Status.online, activity=game) print("------") @@ -59,10 +59,10 @@ class Bot(commands.Bot): if sys.platform == "Linux": asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) - loop = asyncio.get_event_loop() + loop = asyncio.new_event_loop() else: asyncio.set_event_loop_policy(winloop.EventLoopPolicy()) - loop = asyncio.get_event_loop() + loop = asyncio.new_event_loop() bot = Bot( command_prefix=get_prefix, diff --git a/lib/checks.py b/lib/checks.py index 09a91a9..3df722d 100644 --- a/lib/checks.py +++ b/lib/checks.py @@ -1,14 +1,5 @@ from discord.ext import commands -# Copyright (C) Flumboni - All Rights Reserved -# Unauthorized copying of this file, via any medium is strictly prohibited -# Proprietary and confidential -def check_flum(): - async def predicate(ctx): - ids = [320825953154760704, 344273597612818444, 274983796414349313] - return ctx.author.id not in ids - return commands.check(predicate) - def check_bot(): async def predicate(ctx): return not ctx.author.bot diff --git a/lib/mod.py b/lib/mod.py index 7bb61cf..237ccdd 100644 --- a/lib/mod.py +++ b/lib/mod.py @@ -78,5 +78,5 @@ class Mod(commands.Cog): await ctx.send(content=content,delete_after=15.0) -def setup(bot): - bot.add_cog(Mod(bot)) \ No newline at end of file +async def setup(bot): + await bot.add_cog(Mod(bot)) \ No newline at end of file