3 Commits

Author SHA1 Message Date
560c7650bd Merge pull request 'Removed native password & disable ssl' (#454) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m24s
Reviewed-on: #454
2023-12-06 18:28:55 +01:00
18386339b7 Merge pull request 'staging' (#453) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m21s
Reviewed-on: #453
2023-12-04 23:04:29 +01:00
db61a764eb Merge pull request 'staging' (#447) from staging into master
All checks were successful
Deploy prod on push / on-push-deploy_sh-edraft (push) Successful in 3m45s
Reviewed-on: #447
2023-12-02 19:34:22 +01:00
22 changed files with 32 additions and 61 deletions

View File

@@ -15,7 +15,6 @@ from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_core.logging.command_logger import CommandLogger
from bot_core.logging.database_logger import DatabaseLogger
from bot_core.logging.event_logger import EventLogger
from bot_core.logging.message_logger import MessageLogger
from bot_core.logging.task_logger import TaskLogger
from bot_data.db_context import DBContext
@@ -46,7 +45,6 @@ class Startup(StartupABC):
services.add_singleton(CustomFileLoggerABC, DatabaseLogger)
services.add_singleton(CustomFileLoggerABC, MessageLogger)
services.add_singleton(CustomFileLoggerABC, TaskLogger)
services.add_singleton(CustomFileLoggerABC, EventLogger)
if self._feature_flags.get_flag(FeatureFlagsEnum.api_module):
services.add_singleton(CustomFileLoggerABC, ApiLogger)

View File

@@ -1,18 +1,20 @@
import asyncio
from cpl_core.configuration import ConfigurationABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnReadyABC
from cpl_discord.service import DiscordBotServiceABC
from cpl_translation import TranslatePipe
from bot_core.abc.client_utils_abc import ClientUtilsABC
from bot_core.environment_variables import MAINTENANCE
from bot_core.logging.event_logger import EventLogger
class CoreExtensionOnReadyEvent(OnReadyABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
client_utils: ClientUtilsABC,
t: TranslatePipe,

View File

@@ -1,15 +1,15 @@
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnReadyABC
from cpl_discord.service import DiscordBotServiceABC
from cpl_translation import TranslatePipe
from bot_core.abc.client_utils_abc import ClientUtilsABC
from bot_core.logging.event_logger import EventLogger
class CoreOnReadyEvent(OnReadyABC):
def __init__(
self,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
client_utils: ClientUtilsABC,
t: TranslatePipe,

View File

@@ -1,15 +0,0 @@
from cpl_core.configuration import ConfigurationABC
from cpl_core.environment import ApplicationEnvironmentABC
from cpl_core.time import TimeFormatSettings
from bot_core.abc.custom_file_logger_abc import CustomFileLoggerABC
class EventLogger(CustomFileLoggerABC):
def __init__(
self,
config: ConfigurationABC,
time_format: TimeFormatSettings,
env: ApplicationEnvironmentABC,
):
CustomFileLoggerABC.__init__(self, "Event", config, time_format, env)

View File

@@ -1,6 +1,7 @@
import datetime
import uuid
from cpl_core.logging import LoggerABC
from cpl_core.time import TimeFormatSettings
from cpl_discord.events.on_command_error_abc import OnCommandErrorABC
from cpl_discord.service import DiscordBotServiceABC
@@ -11,14 +12,13 @@ from discord.ext.commands import Context, CommandError
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.exception.check_error import CheckError
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.model.technician_config import TechnicianConfig
class BaseOnCommandErrorEvent(OnCommandErrorABC):
def __init__(
self,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
messenger: MessageServiceABC,
tech_settings: TechnicianConfig,

View File

@@ -1,10 +1,10 @@
from cpl_core.database.context import DatabaseContextABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnGuildJoinABC
from cpl_discord.service import DiscordBotServiceABC
from discord import Guild
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.model.server import Server
@@ -14,7 +14,7 @@ from bot_data.service.seeder_service import SeederService
class BaseOnGuildJoinEvent(OnGuildJoinABC):
def __init__(
self,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
servers: ServerRepositoryABC,
server_config: ServerConfigRepositoryABC,

View File

@@ -4,15 +4,14 @@ from typing import Union
import discord
from cpl_core.configuration import ConfigurationABC
from cpl_core.database.context import DatabaseContextABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnMemberJoinABC
from cpl_discord.service import DiscordBotServiceABC
from cpl_translation import TranslatePipe
from bot_core.abc.client_utils_abc import ClientUtilsABC
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.abc.permission_service_abc import PermissionServiceABC
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
@@ -21,13 +20,14 @@ from bot_data.model.known_user import KnownUser
from bot_data.model.server_config import ServerConfig
from bot_data.model.user import User
from bot_data.model.user_joined_server import UserJoinedServer
from bot_core.abc.permission_service_abc import PermissionServiceABC
class BaseOnMemberJoinEvent(OnMemberJoinABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
messenger: MessageServiceABC,
permissions: PermissionServiceABC,
db: DatabaseContextABC,

View File

@@ -4,12 +4,12 @@ from typing import Union
import discord
from cpl_core.configuration import ConfigurationABC
from cpl_core.database.context import DatabaseContextABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnMemberRemoveABC
from cpl_translation import TranslatePipe
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
@@ -20,7 +20,7 @@ class BaseOnMemberRemoveEvent(OnMemberRemoveABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
db: DatabaseContextABC,
message_service: MessageServiceABC,
users: UserRepositoryABC,

View File

@@ -4,7 +4,6 @@ from cpl_discord.service import DiscordBotServiceABC
from discord import RawReactionActionEvent
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from modules.base.helper.base_reaction_handler import BaseReactionHandler
@@ -13,7 +12,7 @@ from modules.base.helper.base_reaction_handler import BaseReactionHandler
class BaseOnRawReactionAddEvent(OnRawReactionAddABC):
def __init__(
self,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
servers: ServerRepositoryABC,
auto_roles: AutoRoleRepositoryABC,

View File

@@ -4,7 +4,6 @@ from cpl_discord.service import DiscordBotServiceABC
from discord import RawReactionActionEvent
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.auto_role_repository_abc import AutoRoleRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from modules.base.helper.base_reaction_handler import BaseReactionHandler
@@ -13,7 +12,7 @@ from modules.base.helper.base_reaction_handler import BaseReactionHandler
class BaseOnRawReactionRemoveEvent(OnRawReactionRemoveABC):
def __init__(
self,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
servers: ServerRepositoryABC,
auto_roles: AutoRoleRepositoryABC,

View File

@@ -5,7 +5,6 @@ from cpl_discord.service import DiscordBotServiceABC
from discord import EventStatus
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from modules.base.model.active_event import ActiveEvent
from modules.base.service.event_service import EventService
@@ -13,7 +12,7 @@ from modules.base.service.event_service import EventService
class BaseOnScheduledEventUpdateEvent(OnScheduledEventUpdateABC):
def __init__(
self,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
events: EventService,
):

View File

@@ -8,7 +8,6 @@ from cpl_core.logging import LoggerABC
from cpl_discord.events import OnVoiceStateUpdateABC
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
@@ -26,7 +25,7 @@ class BaseOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
servers: ServerRepositoryABC,
known_users: KnownUserRepositoryABC,
users: UserRepositoryABC,

View File

@@ -6,7 +6,6 @@ from cpl_translation import TranslatePipe
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.model.server_config import ServerConfig
from bot_core.abc.permission_service_abc import PermissionServiceABC
@@ -16,7 +15,7 @@ class BaseOnVoiceStateUpdateEventHelpChannel(OnVoiceStateUpdateABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
servers: ServerRepositoryABC,
permissions: PermissionServiceABC,
message_service: MessageServiceABC,

View File

@@ -5,7 +5,6 @@ from cpl_core.logging import LoggerABC
from cpl_discord.events import OnVoiceStateUpdateABC
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.abc.server_repository_abc import ServerRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
from modules.base.service.event_service import EventService
@@ -15,7 +14,7 @@ class BaseOnVoiceStateUpdateEventScheduledEventBonus(OnVoiceStateUpdateABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
servers: ServerRepositoryABC,
users: UserRepositoryABC,
events: EventService,

View File

@@ -99,7 +99,6 @@ class EventService:
async def check_and_create_scheduled_events(self, guild: Guild):
server = self._servers.get_server_by_discord_id(guild.id)
scheduled_events_from_db = self._events.get_scheduled_events_by_server_id(server.id)
self._logger.debug(__name__, f"Checking {scheduled_events_from_db.count()} events for server {guild.id}")
for scheduled_event in scheduled_events_from_db:
scheduled_event: ScheduledEvent = scheduled_event
from_guild = List(DiscordEvent, guild.scheduled_events).where(
@@ -108,7 +107,6 @@ class EventService:
and x.entity_type == scheduled_event.entity_type
)
if from_guild.count() != 0:
self._logger.debug(__name__, f"Event {scheduled_event.name} already exists on discord server")
continue
kwargs = {"name": scheduled_event.name, "description": scheduled_event.description}
@@ -121,14 +119,14 @@ class EventService:
scheduled_event.interval, scheduled_event.start_time.replace(tzinfo=ZoneInfo("Europe/Berlin"))
)
kwargs["start_time"] = start_time
scheduled_event.start_time = start_time.replace(tzinfo=None)
scheduled_event.start_time = scheduled_event.start_time.replace(tzinfo=None)
if scheduled_event.end_time is not None:
end_time = self._append_interval(
scheduled_event.interval, scheduled_event.end_time.replace(tzinfo=ZoneInfo("Europe/Berlin"))
)
kwargs["end_time"] = end_time
scheduled_event.end_time = end_time.replace(tzinfo=None)
scheduled_event.end_time = scheduled_event.end_time.replace(tzinfo=None)
kwargs["entity_type"] = scheduled_event.entity_type
if scheduled_event.location is not None:
@@ -137,10 +135,9 @@ class EventService:
kwargs["privacy_level"] = PrivacyLevel.guild_only
try:
self._logger.trace(__name__, f"Try to create scheduled event for guild {guild.name}")
self._logger.debug(__name__, f"Try to create scheduled event for guild {guild.name}")
await guild.create_scheduled_event(**kwargs)
self._events.update_scheduled_event(scheduled_event)
self._db.save_changes()
self._logger.debug(__name__, f"Created scheduled event for guild {guild.name}")
except Exception as e:
self._logger.error(__name__, f"Watching scheduled events failed", e)

View File

@@ -10,7 +10,6 @@ from discord import guild
from bot_core.abc.message_service_abc import MessageServiceABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_core.logging.event_logger import EventLogger
from bot_data.model.server_config import ServerConfig
from bot_data.model.technician_config import TechnicianConfig
@@ -19,7 +18,7 @@ class BootLogOnReadyEvent(OnReadyABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
message_service: MessageServiceABC,
translate: TranslatePipe,

View File

@@ -1,8 +1,8 @@
from cpl_core.configuration import ConfigurationABC
from cpl_core.logging import LoggerABC
from cpl_discord.events import OnReadyABC
from cpl_discord.service import DiscordBotServiceABC
from bot_core.logging.event_logger import EventLogger
from bot_core.service.config_service import ConfigService
from bot_core.service.data_integrity_service import DataIntegrityService
from bot_data.abc.server_repository_abc import ServerRepositoryABC
@@ -12,7 +12,7 @@ class ConfigOnReadyEvent(OnReadyABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
servers: ServerRepositoryABC,
config_service: ConfigService,

View File

@@ -5,14 +5,13 @@ from cpl_discord.events import OnMemberJoinABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_core.logging.message_logger import MessageLogger
from bot_data.model.server_config import ServerConfig
from modules.level.service.level_service import LevelService
class LevelOnMemberJoinEvent(OnMemberJoinABC):
def __init__(self, config: ConfigurationABC, logger: EventLogger, level: LevelService):
def __init__(self, config: ConfigurationABC, logger: MessageLogger, level: LevelService):
OnMemberJoinABC.__init__(self)
self._config = config
self._logger = logger

View File

@@ -7,7 +7,6 @@ from discord import RawReactionActionEvent
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.model.server_config import ServerConfig
from modules.level.service.level_service import LevelService
@@ -16,7 +15,7 @@ class LevelOnRawReactionAddEvent(OnRawReactionAddABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
level: LevelService,
):

View File

@@ -7,7 +7,6 @@ from discord import RawReactionActionEvent
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.model.server_config import ServerConfig
from modules.level.service.level_service import LevelService
@@ -16,7 +15,7 @@ class LevelOnRawReactionRemoveEvent(OnRawReactionRemoveABC):
def __init__(
self,
config: ConfigurationABC,
logger: EventLogger,
logger: LoggerABC,
bot: DiscordBotServiceABC,
level: LevelService,
):

View File

@@ -6,13 +6,12 @@ from cpl_discord.events import OnVoiceStateUpdateABC
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings
from bot_core.helper.event_checks import EventChecks
from bot_core.logging.event_logger import EventLogger
from bot_data.model.server_config import ServerConfig
from modules.level.service.level_service import LevelService
class LevelOnVoiceStateUpdateEvent(OnVoiceStateUpdateABC):
def __init__(self, config: ConfigurationABC, logger: EventLogger, level: LevelService):
def __init__(self, config: ConfigurationABC, logger: LoggerABC, level: LevelService):
OnVoiceStateUpdateABC.__init__(self)
self._config = config
self._logger = logger