|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
from abc import ABCMeta
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import datetime
|
|
|
|
from typing import Optional, Sequence, Union
|
|
|
|
from typing import Optional, Sequence, Union
|
|
|
|
import discord
|
|
|
|
import discord
|
|
|
@ -13,7 +14,10 @@ from modules_core.abc.events.on_message_abc import OnMessageABC
|
|
|
|
from modules_core.abc.events.on_ready_abc import OnReadyABC
|
|
|
|
from modules_core.abc.events.on_ready_abc import OnReadyABC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModuleService(ModuleServiceABC):
|
|
|
|
class _MetaCogABC(ABCMeta, commands.CogMeta): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ModuleService(ModuleServiceABC, commands.Cog, metaclass=_MetaCogABC):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, logger: LoggerABC, services: ServiceProviderABC, env: ApplicationEnvironmentABC):
|
|
|
|
def __init__(self, logger: LoggerABC, services: ServiceProviderABC, env: ApplicationEnvironmentABC):
|
|
|
|
self._logger = logger
|
|
|
|
self._logger = logger
|
|
|
@ -38,10 +42,11 @@ class ModuleService(ModuleServiceABC):
|
|
|
|
|
|
|
|
|
|
|
|
async def on_error(self, event: str, *args, **kwargs): pass
|
|
|
|
async def on_error(self, event: str, *args, **kwargs): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_typing(self, channel: discord.abc.Messageable,
|
|
|
|
async def on_typing(self, channel: discord.abc.Messageable, user: Union[discord.User, discord.Member], when: datetime): pass
|
|
|
|
user: Union[discord.User, discord.Member], when: datetime): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@commands.Cog.listener()
|
|
|
|
async def on_message(self, message: discord.Message):
|
|
|
|
async def on_message(self, message: discord.Message):
|
|
|
|
|
|
|
|
self._logger.debug(__name__, f'Received message:\n{message}:\n{message.content}')
|
|
|
|
self._logger.debug(__name__, 'Start on_message modules')
|
|
|
|
self._logger.debug(__name__, 'Start on_message modules')
|
|
|
|
modules = self._modules.where(lambda m: issubclass(m, OnMessageABC))
|
|
|
|
modules = self._modules.where(lambda m: issubclass(m, OnMessageABC))
|
|
|
|
for module_type in modules:
|
|
|
|
for module_type in modules:
|
|
|
@ -53,43 +58,31 @@ class ModuleService(ModuleServiceABC):
|
|
|
|
|
|
|
|
|
|
|
|
async def on_bulk_message_delete(self, message: discord.Message): pass
|
|
|
|
async def on_bulk_message_delete(self, message: discord.Message): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_message_edit(
|
|
|
|
async def on_message_edit(self, before: discord.Message, after: discord.Message): pass
|
|
|
|
self, before: discord.Message, after: discord.Message): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_reaction_add(
|
|
|
|
async def on_reaction_add(self, reaction: discord.Reaction, user: discord.User): pass
|
|
|
|
self, reaction: discord.Reaction, user: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_reaction_remove(
|
|
|
|
async def on_reaction_remove(self, reaction: discord.Reaction, user: discord.User): pass
|
|
|
|
self, reaction: discord.Reaction, user: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_reaction_clear(
|
|
|
|
async def on_reaction_clear(self, message: discord.Message, reactions: list[discord.Reaction]): pass
|
|
|
|
self, message: discord.Message, reactions: list[discord.Reaction]): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_reaction_clear_emoji(self, reaction: discord.Reaction): pass
|
|
|
|
async def on_reaction_clear_emoji(self, reaction: discord.Reaction): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_private_channel_delete(
|
|
|
|
async def on_private_channel_delete(self, channel: discord.abc.PrivateChannel): pass
|
|
|
|
self, channel: discord.abc.PrivateChannel): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_private_channel_create(
|
|
|
|
async def on_private_channel_create(self, channel: discord.abc.PrivateChannel): pass
|
|
|
|
self, channel: discord.abc.PrivateChannel): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_private_channel_update(
|
|
|
|
async def on_private_channel_update(self, before: discord.GroupChannel, after: discord.GroupChannel): pass
|
|
|
|
self, before: discord.GroupChannel, after: discord.GroupChannel): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_private_channel_pins_update(
|
|
|
|
async def on_private_channel_pins_update(self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]): pass
|
|
|
|
self, channel: discord.abc.PrivateChannel, list_pin: Optional[datetime]): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_channel_delete(
|
|
|
|
async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel): pass
|
|
|
|
self, channel: discord.abc.GuildChannel): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_channel_create(
|
|
|
|
async def on_guild_channel_create(self, channel: discord.abc.GuildChannel): pass
|
|
|
|
self, channel: discord.abc.GuildChannel): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_channel_update(
|
|
|
|
async def on_guild_channel_update(self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel): pass
|
|
|
|
self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_channel_pins_update(
|
|
|
|
async def on_guild_channel_pins_update(self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]): pass
|
|
|
|
self, channel: discord.abc.GuildChannel, list_pin: Optional[datetime]): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_integrations_update(self, guild: discord.Guild): pass
|
|
|
|
async def on_guild_integrations_update(self, guild: discord.Guild): pass
|
|
|
|
|
|
|
|
|
|
|
@ -99,41 +92,33 @@ class ModuleService(ModuleServiceABC):
|
|
|
|
|
|
|
|
|
|
|
|
async def on_member_remove(self, member: discord.Member): pass
|
|
|
|
async def on_member_remove(self, member: discord.Member): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_member_update(
|
|
|
|
async def on_member_update(self, before: discord.Member, after: discord.Member): pass
|
|
|
|
self, before: discord.Member, after: discord.Member): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_user_update(self, before: discord.User,
|
|
|
|
async def on_user_update(self, before: discord.User, after: discord.User): pass
|
|
|
|
after: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_join(self, guild: discord.Guild): pass
|
|
|
|
async def on_guild_join(self, guild: discord.Guild): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_remove(self, guild: discord.Guild): pass
|
|
|
|
async def on_guild_remove(self, guild: discord.Guild): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_update(
|
|
|
|
async def on_guild_update(self, before: discord.Guild, after: discord.Guild): pass
|
|
|
|
self, before: discord.Guild, after: discord.Guild): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_role_create(self, role: discord.Role): pass
|
|
|
|
async def on_guild_role_create(self, role: discord.Role): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_role_delete(self, role: discord.Role): pass
|
|
|
|
async def on_guild_role_delete(self, role: discord.Role): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_role_update(
|
|
|
|
async def on_guild_role_update(self, before: discord.Role, after: discord.Role): pass
|
|
|
|
self, before: discord.Role, after: discord.Role): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_emojis_update(
|
|
|
|
async def on_guild_emojis_update(self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]): pass
|
|
|
|
self, guild: discord.Guild, before: Sequence[discord.Emoji], after: Sequence[discord.Emoji]): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_available(self, guild: discord.Guild): pass
|
|
|
|
async def on_guild_available(self, guild: discord.Guild): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_guild_unavailable(self, guild: discord.Guild): pass
|
|
|
|
async def on_guild_unavailable(self, guild: discord.Guild): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_voice_state_update(
|
|
|
|
async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState): pass
|
|
|
|
self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_member_ban(self, guild: discord.Guild,
|
|
|
|
async def on_member_ban(self, guild: discord.Guild, user: discord.User): pass
|
|
|
|
user: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_member_unban(
|
|
|
|
async def on_member_unban(self, guild: discord.Guild, user: discord.User): pass
|
|
|
|
self, guild: discord.Guild, user: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_invite_create(self, invite: discord.Invite): pass
|
|
|
|
async def on_invite_create(self, invite: discord.Invite): pass
|
|
|
|
|
|
|
|
|
|
|
@ -142,14 +127,11 @@ class ModuleService(ModuleServiceABC):
|
|
|
|
async def on_group_join(
|
|
|
|
async def on_group_join(
|
|
|
|
self, chhanel: discord.GroupChannel, user: discord.User): pass
|
|
|
|
self, chhanel: discord.GroupChannel, user: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_group_remove(
|
|
|
|
async def on_group_remove(self, chhanel: discord.GroupChannel, user: discord.User): pass
|
|
|
|
self, chhanel: discord.GroupChannel, user: discord.User): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_relationship_add(
|
|
|
|
async def on_relationship_add(
|
|
|
|
self, relationship: discord.Relationship): pass
|
|
|
|
self, relationship: discord.Relationship): pass
|
|
|
|
|
|
|
|
|
|
|
|
async def on_relationship_remove(
|
|
|
|
async def on_relationship_remove(self, relationship: discord.Relationship): pass
|
|
|
|
self, relationship: discord.Relationship): pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def on_relationship_update(
|
|
|
|
async def on_relationship_update(self, before: discord.Relationship, after: discord.Relationship): pass
|
|
|
|
self, before: discord.Relationship, after: discord.Relationship): pass
|
|
|
|
|
|
|
|