Added scheduled event support for cpl-discord
This commit is contained in:
parent
2c3664c1b9
commit
8179508248
@ -15,7 +15,7 @@ __title__ = 'cpl_discord'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -23,4 +23,4 @@ from collections import namedtuple
|
||||
# imports:
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -55,4 +55,4 @@ def get_discord_collection(services: 'ServiceCollectionABC') -> 'DiscordCollecti
|
||||
# build-ignore-end
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.application'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from collections import namedtuple
|
||||
from .discord_bot_application_abc import DiscordBotApplicationABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.command'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -25,4 +25,4 @@ from .discord_command_abc import DiscordCommandABC
|
||||
from .discord_commands_meta import DiscordCogMeta
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from collections import namedtuple
|
||||
from .discord_bot_settings import DiscordBotSettings
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.container'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -31,4 +31,4 @@ from .thread import Thread
|
||||
from .voice_channel import VoiceChannel
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -4,7 +4,7 @@
|
||||
"Version": {
|
||||
"Major": "2022",
|
||||
"Minor": "12",
|
||||
"Micro": "1.post2"
|
||||
"Micro": "2"
|
||||
},
|
||||
"Author": "Sven Heidemann",
|
||||
"AuthorEmail": "sven.heidemann@sh-edraft.de",
|
||||
@ -16,12 +16,12 @@
|
||||
"LicenseName": "MIT",
|
||||
"LicenseDescription": "MIT, see LICENSE for more details.",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.12.1.post2",
|
||||
"discord.py==2.1.0",
|
||||
"cpl-query>=2022.12.2.post1"
|
||||
"cpl-core==2022.12.1.post3",
|
||||
"discord.py==2.1.1",
|
||||
"cpl-query==2022.12.2.post1"
|
||||
],
|
||||
"DevDependencies": [
|
||||
"cpl-cli>=2022.12.1"
|
||||
"cpl-cli==2022.12.1.post3"
|
||||
],
|
||||
"PythonVersion": ">=3.10",
|
||||
"PythonPath": {},
|
||||
|
@ -47,6 +47,11 @@ from cpl_discord.events.on_reaction_clear_emoji_abc import OnReactionClearEmojiA
|
||||
from cpl_discord.events.on_reaction_remove_abc import OnReactionRemoveABC
|
||||
from cpl_discord.events.on_ready_abc import OnReadyABC
|
||||
from cpl_discord.events.on_resume_abc import OnResumeABC
|
||||
from cpl_discord.events.on_scheduled_event_create_abc import OnScheduledEventCreateABC
|
||||
from cpl_discord.events.on_scheduled_event_delete_abc import OnScheduledEventDeleteABC
|
||||
from cpl_discord.events.on_scheduled_event_update_abc import OnScheduledEventUpdateABC
|
||||
from cpl_discord.events.on_scheduled_event_user_add_abc import OnScheduledEventUserAddABC
|
||||
from cpl_discord.events.on_scheduled_event_user_remove_abc import OnScheduledEventUserRemoveABC
|
||||
from cpl_discord.events.on_typing_abc import OnTypingABC
|
||||
from cpl_discord.events.on_user_update_abc import OnUserUpdateABC
|
||||
from cpl_discord.events.on_voice_state_update_abc import OnVoiceStateUpdateABC
|
||||
@ -76,6 +81,11 @@ class DiscordEventTypesEnum(Enum):
|
||||
on_guild_role_delete = OnGuildRoleDeleteABC
|
||||
on_guild_role_update = OnGuildRoleUpdateABC
|
||||
on_guild_unavailable = OnGuildUnavailableABC
|
||||
on_scheduled_event_create = OnScheduledEventCreateABC
|
||||
on_scheduled_event_delete = OnScheduledEventDeleteABC
|
||||
on_scheduled_event_update = OnScheduledEventUpdateABC
|
||||
on_scheduled_event_user_add = OnScheduledEventUserAddABC
|
||||
on_scheduled_event_user_remove = OnScheduledEventUserRemoveABC
|
||||
on_guild_update = OnGuildUpdateABC
|
||||
on_invite_create = OnInviteCreateABC
|
||||
on_invite_delete = OnInviteDeleteABC
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.events'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -69,4 +69,4 @@ from .on_voice_state_update_abc import OnVoiceStateUpdateABC
|
||||
from .on_webhooks_update_abc import OnWebhooksUpdateABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
11
src/cpl_discord/events/on_scheduled_event_create_abc.py
Normal file
11
src/cpl_discord/events/on_scheduled_event_create_abc.py
Normal file
@ -0,0 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import discord
|
||||
|
||||
|
||||
class OnScheduledEventCreateABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
async def on_scheduled_event_create(self, event: discord.ScheduledEvent): pass
|
11
src/cpl_discord/events/on_scheduled_event_delete_abc.py
Normal file
11
src/cpl_discord/events/on_scheduled_event_delete_abc.py
Normal file
@ -0,0 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import discord
|
||||
|
||||
|
||||
class OnScheduledEventDeleteABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
async def on_scheduled_event_delete(self, event: discord.ScheduledEvent): pass
|
11
src/cpl_discord/events/on_scheduled_event_update_abc.py
Normal file
11
src/cpl_discord/events/on_scheduled_event_update_abc.py
Normal file
@ -0,0 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import discord
|
||||
|
||||
|
||||
class OnScheduledEventUpdateABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
async def on_scheduled_event_update(self, before: discord.ScheduledEvent, after: discord.ScheduledEvent): pass
|
11
src/cpl_discord/events/on_scheduled_event_user_add_abc.py
Normal file
11
src/cpl_discord/events/on_scheduled_event_user_add_abc.py
Normal file
@ -0,0 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import discord
|
||||
|
||||
|
||||
class OnScheduledEventUserAddABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
async def on_scheduled_event_user_add(self, event: discord.ScheduledEvent, user: discord.User): pass
|
11
src/cpl_discord/events/on_scheduled_event_user_remove_abc.py
Normal file
11
src/cpl_discord/events/on_scheduled_event_user_remove_abc.py
Normal file
@ -0,0 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import discord
|
||||
|
||||
|
||||
class OnScheduledEventUserRemoveABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
async def on_scheduled_event_user_remove(self, event: discord.ScheduledEvent, user: discord.User): pass
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.helper'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -24,4 +24,4 @@ from collections import namedtuple
|
||||
from .to_containers_converter import ToContainersConverter
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -15,7 +15,7 @@ __title__ = 'cpl_discord.service'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2022 - 2023 sh-edraft.de'
|
||||
__version__ = '2022.12.1.post2'
|
||||
__version__ = '2022.12.2'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@ -29,4 +29,4 @@ from .discord_service import DiscordService
|
||||
from .discord_service_abc import DiscordServiceABC
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='1.post2')
|
||||
version_info = VersionInfo(major='2022', minor='12', micro='2')
|
||||
|
@ -57,6 +57,11 @@ from cpl_discord.events.on_reaction_clear_emoji_abc import OnReactionClearEmojiA
|
||||
from cpl_discord.events.on_reaction_remove_abc import OnReactionRemoveABC
|
||||
from cpl_discord.events.on_ready_abc import OnReadyABC
|
||||
from cpl_discord.events.on_resume_abc import OnResumeABC
|
||||
from cpl_discord.events.on_scheduled_event_create_abc import OnScheduledEventCreateABC
|
||||
from cpl_discord.events.on_scheduled_event_delete_abc import OnScheduledEventDeleteABC
|
||||
from cpl_discord.events.on_scheduled_event_update_abc import OnScheduledEventUpdateABC
|
||||
from cpl_discord.events.on_scheduled_event_user_add_abc import OnScheduledEventUserAddABC
|
||||
from cpl_discord.events.on_scheduled_event_user_remove_abc import OnScheduledEventUserRemoveABC
|
||||
from cpl_discord.events.on_typing_abc import OnTypingABC
|
||||
from cpl_discord.events.on_user_update_abc import OnUserUpdateABC
|
||||
from cpl_discord.events.on_voice_state_update_abc import OnVoiceStateUpdateABC
|
||||
@ -339,6 +344,31 @@ class DiscordService(DiscordServiceABC, commands.Cog, metaclass=DiscordCogMeta):
|
||||
self._logger.trace(__name__, f'Received on_guild_unavailable:\n\t{guild}')
|
||||
await self._handle_event(OnGuildUnavailableABC, guild)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_scheduled_event_create(self, event: discord.ScheduledEvent):
|
||||
self._logger.trace(__name__, f'Received on_scheduled_event_create:\n\t{event}')
|
||||
await self._handle_event(OnScheduledEventCreateABC, event)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_scheduled_event_delete(self, event: discord.ScheduledEvent):
|
||||
self._logger.trace(__name__, f'Received on_scheduled_event_delete:\n\t{event}')
|
||||
await self._handle_event(OnScheduledEventDeleteABC, event)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_scheduled_event_update(self, before: discord.ScheduledEvent, after: discord.ScheduledEvent):
|
||||
self._logger.trace(__name__, f'Received on_scheduled_event_update:\n\t{before}, {after}')
|
||||
await self._handle_event(OnScheduledEventUpdateABC, before, after)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_scheduled_event_user_add(self, event: discord.ScheduledEvent, user: discord.User):
|
||||
self._logger.trace(__name__, f'Received on_scheduled_event_user_add:\n\t{event}, {user}')
|
||||
await self._handle_event(OnScheduledEventUserAddABC, event, user)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_scheduled_event_user_remove(self, event: discord.ScheduledEvent, user: discord.User):
|
||||
self._logger.trace(__name__, f'Received on_scheduled_event_user_remove:\n\t{event}, {user}')
|
||||
await self._handle_event(OnScheduledEventUserRemoveABC, event, user)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_voice_state_update(self, member: discord.Member, before: discord.VoiceState, after: discord.VoiceState):
|
||||
self._logger.trace(__name__, f'Received on_voice_state_update:\n\t{member}\n\t{before}\n\t{after}')
|
||||
|
Loading…
Reference in New Issue
Block a user