D
D
Dream2021-06-11 22:25:20
Python
Dream, 2021-06-11 22:25:20

How to check if cog is loaded via extension?

How to check if cog is loaded via extension? And check if it's loaded?
To issue by type: cog - on / off

Fragment reload:

bot.unload_extension(f"cogs.{extension}")
bot.load_extension(f"cogs.{extension}")
print("File " + str(extension) + " reload")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Endora Blackwell, 2021-06-12
@dreameddd

In this case, you can use try except to check for errors

try:
    bot.unload_extension(f"cogs.{extension}")
    bot.load_extension(f"cogs.{extension}")
    print("File " + str(extension) + " reload")
except Exception as e:
    exc = '{}: {}'.format(type(e).__name__, e)
    print(exc)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question