#38 - cpl update #40

Merged
edraft merged 2 commits from #38 into 0.2 2022-09-30 17:29:43 +02:00
39 changed files with 90 additions and 86 deletions
Showing only changes of commit b936e569aa - Show all commits

View File

@ -15,7 +15,7 @@ __title__ = 'bot'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -3,8 +3,8 @@
"Name": "bot",
"Version": {
"Major": "0",
"Minor": "1",
"Micro": "14"
"Minor": "2",
"Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,13 +16,13 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0.post4",
"cpl-translation==2022.10rc2",
"cpl-query==2022.10rc2",
"cpl-discord==2022.7.0.post4"
"cpl-core>=2022.10.0",
"cpl-translation>=2022.10.0",
"cpl-query>=2022.10.0",
"cpl-discord>=2022.10.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'bot_core'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_core.abc'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
"Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,10 +16,10 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
"cpl-core>=2022.10.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'bot_core.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_core.pipes'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_core.service'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_data'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_data.abc'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "1",
"Minor": "0",
"Micro": "0.dev1"
"Micro": "0"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,10 +16,10 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0"
"cpl-core>=2022.10.0"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post1"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'bot_data.migration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_data.model'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'bot_data.service'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.admin'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.7.0.post5"
"cpl-core>=2022.10.0.post5"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'modules.admin.command'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.base'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.base.abc'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.7.0.post2"
"cpl-core>=2022.10.0.post2"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'modules.base.command'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.base.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.base.events'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.base.service'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.boot_log'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.7.0.post2"
"cpl-core>=2022.10.0.post2"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'modules.boot_log.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.database'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [
"cpl-core>=2022.7.0.post2"
"cpl-core>=2022.10.0.post2"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -8,6 +8,7 @@ from cpl_core.logging import LoggerABC
from cpl_discord.events import OnReadyABC
from cpl_discord.service import DiscordBotServiceABC
from bot_core.pipes.date_time_offset_pipe import DateTimeOffsetPipe
from bot_data.abc.client_repository_abc import ClientRepositoryABC
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
@ -20,6 +21,7 @@ from bot_data.model.user import User
from bot_data.model.user_joined_server import UserJoinedServer
from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel
from bot_data.service.user_repository_service import ServerRepositoryABC
from modules.base.configuration.base_server_settings import BaseServerSettings
class DatabaseOnReadyEvent(OnReadyABC):
@ -35,7 +37,8 @@ class DatabaseOnReadyEvent(OnReadyABC):
client_repo: ClientRepositoryABC,
known_users: KnownUserRepositoryABC,
user_joins: UserJoinedServerRepositoryABC,
user_joins_vc: UserJoinedVoiceChannelRepositoryABC
user_joins_vc: UserJoinedVoiceChannelRepositoryABC,
dtp: DateTimeOffsetPipe
):
self._config = config
@ -48,6 +51,7 @@ class DatabaseOnReadyEvent(OnReadyABC):
self._known_users = known_users
self._user_joins = user_joins
self._user_joins_vc = user_joins_vc
self._dtp = dtp
OnReadyABC.__init__(self)
self._logger.info(__name__, f'Module {type(self)} loaded')
@ -213,7 +217,7 @@ class DatabaseOnReadyEvent(OnReadyABC):
m: discord.Member = u
self._logger.warn(__name__, f'Active UserJoinedServer not found in database: {guild.id}:{u.id}@{m.joined_at}')
self._logger.debug(__name__, f'Add UserJoinedServer: {guild.id}:{u.id}@{m.joined_at}')
self._user_joins.add_user_joined_server(UserJoinedServer(user, m.joined_at, None))
self._user_joins.add_user_joined_server(UserJoinedServer(user, self._dtp.transform(m.joined_at), None))
self._db_context.save_changes()
self._logger.debug(__name__, f'Added UserJoinedServer: {u.id}')
@ -267,7 +271,7 @@ class DatabaseOnReadyEvent(OnReadyABC):
for join in joins:
self._logger.warn(__name__, f'Active UserJoinedVoiceChannel found in database: {guild.id}:{member.id}@{join.joined_on}')
join.leaved_on = datetime.now()
settings: BaseSettings = self._config.get_configuration(f'BaseServerSettings_{guild.id}')
settings: BaseServerSettings = self._config.get_configuration(f'BaseServerSettings_{guild.id}')
if ((join.leaved_on - join.joined_on).total_seconds() / 60 / 60) > settings.max_voice_state_hours:
join.leaved_on = join.joined_on + timedelta(hours=settings.max_voice_state_hours)

View File

@ -15,7 +15,7 @@ __title__ = 'modules.moderator'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.moderator.command'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.7.0.post5"
"cpl-core>=2022.10.0.post5"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'modules.permission'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.permission.abc'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.permission.configuration'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -15,7 +15,7 @@ __title__ = 'modules.permission.events'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports:
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')

View File

@ -16,10 +16,10 @@
"LicenseName": "",
"LicenseDescription": "",
"Dependencies": [
"cpl-core>=2022.7.0.post2"
"cpl-core>=2022.10.0.post2"
],
"DevDependencies": [
"cpl-cli>=2022.7.0.post2"
"cpl-cli>=2022.10.0"
],
"PythonVersion": ">=3.10.4",
"PythonPath": {

View File

@ -15,7 +15,7 @@ __title__ = 'modules.permission.service'
__author__ = 'Sven Heidemann'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2022 sh-edraft.de'
__version__ = '0.1.14'
__version__ = '0.2.0'
from collections import namedtuple
@ -23,4 +23,4 @@ from collections import namedtuple
# imports
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
version_info = VersionInfo(major='0', minor='1', micro='14')
version_info = VersionInfo(major='0', minor='2', micro='0')