mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
[V3 Core] Fix unload_extension for module-less cogs (#1984)
Fixes #1943 This just skips cogs when `__module__` is None. Also: - backported rapptz/discord.py#621 - moved RPC handler unregister to remove_cog() - raise an exception when a load would overwrite an existing extension
This commit is contained in:
committed by
Toby Harradine
parent
aec3ad382a
commit
872cce784a
@@ -111,7 +111,7 @@ class RPCMixin:
|
||||
super().__init__(**kwargs)
|
||||
self.rpc = RPC()
|
||||
|
||||
self.rpc_handlers = {} # Lowered cog name to method
|
||||
self.rpc_handlers = {} # Uppercase cog name to method
|
||||
|
||||
def register_rpc_handler(self, method):
|
||||
"""
|
||||
@@ -132,6 +132,7 @@ class RPCMixin:
|
||||
self.rpc.add_method(method)
|
||||
|
||||
cog_name = method.__self__.__class__.__name__.upper()
|
||||
|
||||
if cog_name not in self.rpc_handlers:
|
||||
self.rpc_handlers[cog_name] = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user