Merge pull request 'Vergebene XP für Nachrichten und Reaktionen pro Stunde begrenzen #168' (#176) from #168 into 0.3.1
Reviewed-on: sh-edraft.de/kd_discord_bot#176 Reviewed-by: Ebola-Chan <nick.jungmann@gmail.com> Closes #168
This commit is contained in:
commit
2a0e3d77b7
@ -1 +1 @@
|
||||
Subproject commit 28bd879dab2e5ea6ca8bb38e44c7786eb67cb7a2
|
||||
Subproject commit 54b1b3860cb570d29c8ba2590dd082a1fa744265
|
@ -10,6 +10,7 @@ from bot_data.migration.auto_role_migration import AutoRoleMigration
|
||||
from bot_data.migration.initial_migration import InitialMigration
|
||||
from bot_data.migration.level_migration import LevelMigration
|
||||
from bot_data.migration.stats_migration import StatsMigration
|
||||
from bot_data.migration.user_message_count_per_hour_migration import UserMessageCountPerHourMigration
|
||||
from bot_data.service.migration_service import MigrationService
|
||||
|
||||
|
||||
@ -29,3 +30,4 @@ class StartupMigrationExtension(StartupExtensionABC):
|
||||
services.add_transient(MigrationABC, LevelMigration) # 06.11.2022 #25 - 0.3.0
|
||||
services.add_transient(MigrationABC, StatsMigration) # 09.11.2022 #46 - 0.3.0
|
||||
services.add_transient(MigrationABC, AutoRoleFix1Migration) # 30.12.2022 #151 - 0.3.0
|
||||
services.add_transient(MigrationABC, UserMessageCountPerHourMigration) # 11.01.2023 #168 - 0.3.1
|
||||
|
@ -5,9 +5,12 @@ from cpl_query.extension import List
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_data.model.user import User
|
||||
from modules.base.configuration.base_server_settings import BaseServerSettings
|
||||
from bot_data.model.user import User
|
||||
|
||||
|
||||
class ClientUtilsServiceABC(ABC):
|
||||
|
||||
class ClientUtilsABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
@ -36,5 +39,11 @@ class ClientUtilsServiceABC(ABC):
|
||||
@abstractmethod
|
||||
def get_auto_complete_list(self, _l: List, current: str, select: Callable = None) -> List: pass
|
||||
|
||||
@abstractmethod
|
||||
def is_message_xp_count_by_hour_higher_that_max_message_count_per_hour(
|
||||
self, created_at: datetime, user: User, settings: BaseServerSettings,
|
||||
is_reaction: bool = False
|
||||
) -> bool: pass
|
||||
|
||||
@abstractmethod
|
||||
def get_ontime_for_user(self, user: User) -> float: pass
|
@ -3,7 +3,7 @@ from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.dependency_injection import ServiceProviderABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
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
|
||||
@ -23,7 +23,7 @@ class CoreExtension(ApplicationExtensionABC):
|
||||
return
|
||||
|
||||
permissions: PermissionServiceABC = services.get_service(PermissionServiceABC)
|
||||
client_utils: ClientUtilsServiceABC = services.get_service(ClientUtilsServiceABC)
|
||||
client_utils: ClientUtilsABC = services.get_service(ClientUtilsABC)
|
||||
message_service: MessageServiceABC = services.get_service(MessageServiceABC)
|
||||
t: TranslatePipe = services.get_service(TranslatePipe)
|
||||
CommandChecks.init(permissions, client_utils, message_service, t)
|
||||
|
@ -5,7 +5,7 @@ from cpl_discord.events import OnReadyABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
|
||||
|
||||
class CoreExtensionOnReadyEvent(OnReadyABC):
|
||||
@ -14,7 +14,7 @@ class CoreExtensionOnReadyEvent(OnReadyABC):
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
t: TranslatePipe
|
||||
):
|
||||
OnReadyABC.__init__(self)
|
||||
|
@ -4,7 +4,7 @@ from cpl_core.environment import ApplicationEnvironmentABC
|
||||
from cpl_discord.discord_event_types_enum import DiscordEventTypesEnum
|
||||
from cpl_discord.service.discord_collection_abc import DiscordCollectionABC
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.abc.module_abc import ModuleABC
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
@ -24,7 +24,7 @@ class CoreModule(ModuleABC):
|
||||
|
||||
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC):
|
||||
services.add_transient(MessageServiceABC, MessageService)
|
||||
services.add_transient(ClientUtilsServiceABC, ClientUtilsService)
|
||||
services.add_transient(ClientUtilsABC, ClientUtilsService)
|
||||
|
||||
# pipes
|
||||
services.add_transient(DateTimeOffsetPipe)
|
||||
|
@ -3,7 +3,7 @@ from cpl_discord.events import OnReadyABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_translation import TranslatePipe
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
|
||||
|
||||
class CoreOnReadyEvent(OnReadyABC):
|
||||
@ -12,7 +12,7 @@ class CoreOnReadyEvent(OnReadyABC):
|
||||
self,
|
||||
logger: LoggerABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
t: TranslatePipe,
|
||||
):
|
||||
OnReadyABC.__init__(self)
|
||||
|
@ -4,7 +4,7 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.exception.check_error import CheckError
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
@ -12,7 +12,7 @@ from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
|
||||
class CommandChecks:
|
||||
_permissions: Optional[PermissionServiceABC] = None
|
||||
_client_utils: Optional[ClientUtilsServiceABC] = None
|
||||
_client_utils: Optional[ClientUtilsABC] = None
|
||||
_message_service: Optional[MessageServiceABC] = None
|
||||
_t: Optional[TranslatePipe] = None
|
||||
|
||||
@ -20,7 +20,7 @@ class CommandChecks:
|
||||
def init(
|
||||
cls,
|
||||
permissions: PermissionServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
message_service: MessageServiceABC,
|
||||
translate: TranslatePipe,
|
||||
):
|
||||
|
@ -4,19 +4,19 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.exception.check_error import CheckError
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
|
||||
|
||||
class EventChecks:
|
||||
_client_utils: Optional[ClientUtilsServiceABC] = None
|
||||
_client_utils: Optional[ClientUtilsABC] = None
|
||||
|
||||
@classmethod
|
||||
def init(
|
||||
cls,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
):
|
||||
cls._client_utils = client_utils
|
||||
|
||||
|
@ -1,46 +1,52 @@
|
||||
from typing import Callable
|
||||
|
||||
import discord
|
||||
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from cpl_core.configuration import ConfigurationABC
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
|
||||
from cpl_core.time import TimeFormatSettings
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from cpl_query.extension import List
|
||||
from cpl_translation import TranslatePipe
|
||||
from discord import app_commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
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_data.abc.client_repository_abc import ClientRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_message_count_per_hour_repository_abc import UserMessageCountPerHourRepositoryABC
|
||||
from bot_data.model.user import User
|
||||
from bot_data.model.user_message_count_per_hour import UserMessageCountPerHour
|
||||
from modules.base.configuration.base_server_settings import BaseServerSettings
|
||||
|
||||
|
||||
class ClientUtilsService(ClientUtilsServiceABC):
|
||||
class ClientUtilsService(ClientUtilsABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
config: ConfigurationABC,
|
||||
logger: LoggerABC,
|
||||
time_format: TimeFormatSettings,
|
||||
bot: DiscordBotServiceABC,
|
||||
servers: ServerRepositoryABC,
|
||||
clients: ClientRepositoryABC,
|
||||
umcphs: UserMessageCountPerHourRepositoryABC,
|
||||
user_joined_vc: UserJoinedVoiceChannelRepositoryABC,
|
||||
message_service: MessageServiceABC,
|
||||
db: DatabaseContextABC,
|
||||
t: TranslatePipe,
|
||||
feature_flags: FeatureFlagsSettings
|
||||
):
|
||||
ClientUtilsServiceABC.__init__(self)
|
||||
ClientUtilsABC.__init__(self)
|
||||
self._config = config
|
||||
self._logger = logger
|
||||
self._time_format = time_format
|
||||
self._bot = bot
|
||||
self._servers = servers
|
||||
self._umcphs = umcphs
|
||||
self._clients = clients
|
||||
self._user_joined_voice_channel = user_joined_vc
|
||||
self._message_service = message_service
|
||||
@ -84,6 +90,8 @@ class ClientUtilsService(ClientUtilsServiceABC):
|
||||
async def check_if_bot_is_ready_yet_and_respond(self, ctx: Context) -> bool:
|
||||
result = await self.check_if_bot_is_ready_yet()
|
||||
if not result:
|
||||
await self._message_service.send_ctx_msg(ctx, self._t.transform('common.errors.bot_not_ready_yet'),
|
||||
without_tracking=True)
|
||||
await self._message_service.send_ctx_msg(
|
||||
ctx,
|
||||
self._t.transform('common.errors.bot_not_ready_yet'),
|
||||
@ -115,6 +123,51 @@ class ClientUtilsService(ClientUtilsServiceABC):
|
||||
|
||||
return _l.take(25)
|
||||
|
||||
def is_message_xp_count_by_hour_higher_that_max_message_count_per_hour(
|
||||
self,
|
||||
created_at: datetime,
|
||||
user: User,
|
||||
settings: BaseServerSettings,
|
||||
is_reaction: bool = False
|
||||
) -> bool:
|
||||
umcph = None
|
||||
try:
|
||||
umcph = self._umcphs.find_user_message_count_per_hour_by_user_id_and_date(user.user_id, created_at)
|
||||
if umcph is None:
|
||||
self._umcphs.add_user_message_count_per_hour(UserMessageCountPerHour(
|
||||
created_at.strftime(self._time_format.date_time_format),
|
||||
created_at.hour,
|
||||
0,
|
||||
user
|
||||
))
|
||||
|
||||
self._db.save_changes()
|
||||
|
||||
umcph = self._umcphs.get_user_message_count_per_hour_by_user_id_and_date(
|
||||
user.user_id,
|
||||
created_at
|
||||
)
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Cannot add user message count per hour with id {umcph.id}', e)
|
||||
return False
|
||||
|
||||
try:
|
||||
if is_reaction:
|
||||
umcph.xp_count += settings.xp_per_reaction
|
||||
else:
|
||||
umcph.xp_count += settings.xp_per_message
|
||||
|
||||
self._umcphs.update_user_message_count_per_hour(umcph)
|
||||
self._db.save_changes()
|
||||
except Exception as e:
|
||||
self._logger.error(__name__, f'Cannot update user message count per hour with id {umcph.id}', e)
|
||||
return False
|
||||
|
||||
if umcph.xp_count is None:
|
||||
return False
|
||||
|
||||
return umcph.xp_count > settings.max_message_xp_per_hour
|
||||
|
||||
def get_ontime_for_user(self, user: User) -> float:
|
||||
return self._user_joined_voice_channel.get_user_joined_voice_channels_by_user_id(user.user_id) \
|
||||
.where(lambda x: x.leaved_on is not None and x.joined_on is not None) \
|
||||
|
@ -0,0 +1,39 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_data.model.user_message_count_per_hour import UserMessageCountPerHour
|
||||
|
||||
|
||||
class UserMessageCountPerHourRepositoryABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def __init__(self): pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_message_count_per_hours(self) -> List[UserMessageCountPerHour]: pass
|
||||
|
||||
@abstractmethod
|
||||
def find_user_message_count_per_hour_by_user_id(self, user_id: int) -> Optional[UserMessageCountPerHour]: pass
|
||||
|
||||
@abstractmethod
|
||||
def get_user_message_count_per_hour_by_user_id_and_date(self, user_id: int, date: datetime) -> \
|
||||
Optional[UserMessageCountPerHour]: pass
|
||||
|
||||
@abstractmethod
|
||||
def find_user_message_count_per_hour_by_user_id_and_date(self, user_id: int, date: datetime) -> \
|
||||
Optional[UserMessageCountPerHour]: pass
|
||||
|
||||
@abstractmethod
|
||||
def add_user_message_count_per_hour(self, umcph: UserMessageCountPerHour): pass
|
||||
|
||||
@abstractmethod
|
||||
def update_user_message_count_per_hour(self, umcph: UserMessageCountPerHour): pass
|
||||
|
||||
@abstractmethod
|
||||
def delete_user_message_count_per_hour(self, umcph: UserMessageCountPerHour): pass
|
||||
|
||||
@abstractmethod
|
||||
def delete_user_message_count_per_hour_by_user_id(self, user_id: int): pass
|
@ -13,7 +13,8 @@ from bot_data.abc.level_repository_abc import LevelRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.statistic_repository_abc import StatisticRepositoryABC
|
||||
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_message_count_per_hour_repository_abc import UserMessageCountPerHourRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.service.auth_user_repository_service import AuthUserRepositoryService
|
||||
from bot_data.service.auto_role_repository_service import AutoRoleRepositoryService
|
||||
@ -24,7 +25,8 @@ from bot_data.service.seeder_service import SeederService
|
||||
from bot_data.service.server_repository_service import ServerRepositoryService
|
||||
from bot_data.service.statistic_repository_service import StatisticRepositoryService
|
||||
from bot_data.service.user_joined_server_repository_service import UserJoinedServerRepositoryService
|
||||
from bot_data.service.user_joined_voice_channel_service import UserJoinedVoiceChannelRepositoryService
|
||||
from bot_data.service.user_joined_voice_channel_repository_service import UserJoinedVoiceChannelRepositoryService
|
||||
from bot_data.service.user_message_count_per_hour_repository_service import UserMessageCountPerHourRepositoryService
|
||||
from bot_data.service.user_repository_service import UserRepositoryService
|
||||
|
||||
|
||||
@ -47,5 +49,6 @@ class DataModule(ModuleABC):
|
||||
services.add_transient(AutoRoleRepositoryABC, AutoRoleRepositoryService)
|
||||
services.add_transient(LevelRepositoryABC, LevelRepositoryService)
|
||||
services.add_transient(StatisticRepositoryABC, StatisticRepositoryService)
|
||||
services.add_transient(UserMessageCountPerHourRepositoryABC, UserMessageCountPerHourRepositoryService)
|
||||
|
||||
services.add_transient(SeederService)
|
||||
|
@ -0,0 +1,35 @@
|
||||
from bot_core.logging.database_logger import DatabaseLogger
|
||||
from bot_data.abc.migration_abc import MigrationABC
|
||||
from bot_data.db_context import DBContext
|
||||
|
||||
|
||||
class UserMessageCountPerHourMigration(MigrationABC):
|
||||
name = '0.3.1_UserMessageCountPerHourMigration'
|
||||
|
||||
def __init__(self, logger: DatabaseLogger, db: DBContext):
|
||||
MigrationABC.__init__(self)
|
||||
self._logger = logger
|
||||
self._db = db
|
||||
self._cursor = db.cursor
|
||||
|
||||
def upgrade(self):
|
||||
self._logger.debug(__name__, 'Running upgrade')
|
||||
|
||||
self._cursor.execute(
|
||||
str(f"""
|
||||
CREATE TABLE IF NOT EXISTS `UserMessageCountPerHour` (
|
||||
`Id` BIGINT NOT NULL AUTO_INCREMENT,
|
||||
`Date` DATETIME(6) NOT NULL,
|
||||
`Hour` BIGINT,
|
||||
`XPCount` BIGINT,
|
||||
`UserId` BIGINT,
|
||||
`CreatedAt` DATETIME(6),
|
||||
`LastModifiedAt` DATETIME(6),
|
||||
PRIMARY KEY(`Id`),
|
||||
FOREIGN KEY (`UserId`) REFERENCES `Users`(`UserId`)
|
||||
);
|
||||
""")
|
||||
)
|
||||
|
||||
def downgrade(self):
|
||||
self._cursor.execute('DROP TABLE `UserMessageCountPerHour`;')
|
@ -29,6 +29,7 @@ class Level(TableABC):
|
||||
|
||||
@name.setter
|
||||
def name(self, value: str):
|
||||
self._modified_at = datetime.now().isoformat()
|
||||
self._name = value
|
||||
|
||||
@property
|
||||
@ -37,6 +38,7 @@ class Level(TableABC):
|
||||
|
||||
@color.setter
|
||||
def color(self, value: str):
|
||||
self._modified_at = datetime.now().isoformat()
|
||||
self._color = value
|
||||
|
||||
@property
|
||||
@ -45,6 +47,7 @@ class Level(TableABC):
|
||||
|
||||
@min_xp.setter
|
||||
def min_xp(self, value: int):
|
||||
self._modified_at = datetime.now().isoformat()
|
||||
self._min_xp = value
|
||||
|
||||
@property
|
||||
@ -53,6 +56,7 @@ class Level(TableABC):
|
||||
|
||||
@permissions.setter
|
||||
def permissions(self, value: int):
|
||||
self._modified_at = datetime.now().isoformat()
|
||||
self._permissions = value
|
||||
|
||||
@property
|
||||
@ -61,6 +65,7 @@ class Level(TableABC):
|
||||
|
||||
@server.setter
|
||||
def server(self, value: Server):
|
||||
self._modified_at = datetime.now().isoformat()
|
||||
self._server = value
|
||||
|
||||
@staticmethod
|
||||
|
121
kdb-bot/src/bot_data/model/user_message_count_per_hour.py
Normal file
121
kdb-bot/src/bot_data/model/user_message_count_per_hour.py
Normal file
@ -0,0 +1,121 @@
|
||||
from datetime import datetime
|
||||
|
||||
from cpl_core.database import TableABC
|
||||
|
||||
from bot_data.model.user import User
|
||||
|
||||
|
||||
class UserMessageCountPerHour(TableABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
date: str,
|
||||
hour: int,
|
||||
xp_count: int,
|
||||
user: User,
|
||||
created_at: datetime = None,
|
||||
modified_at: datetime = None,
|
||||
id=0):
|
||||
self._id = id
|
||||
self._date = date
|
||||
self._hour = hour
|
||||
self._xp_count = xp_count
|
||||
self._user = user
|
||||
|
||||
TableABC.__init__(self)
|
||||
self._created_at = created_at if created_at is not None else self._created_at
|
||||
self._modified_at = modified_at if modified_at is not None else self._modified_at
|
||||
|
||||
@property
|
||||
def id(self) -> int:
|
||||
return self._id
|
||||
|
||||
@property
|
||||
def date(self) -> datetime:
|
||||
return self._date
|
||||
|
||||
@property
|
||||
def hour(self) -> int:
|
||||
return self._hour
|
||||
|
||||
@property
|
||||
def xp_count(self) -> int:
|
||||
return self._xp_count
|
||||
|
||||
@xp_count.setter
|
||||
def xp_count(self, value: int):
|
||||
self._modified_at = datetime.now().isoformat()
|
||||
self._xp_count = value
|
||||
|
||||
@property
|
||||
def user(self) -> User:
|
||||
return self._user
|
||||
|
||||
@staticmethod
|
||||
def get_select_all_string() -> str:
|
||||
return str(f"""
|
||||
SELECT * FROM `UserMessageCountPerHour`;
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_by_id_string(id: int) -> str:
|
||||
return str(f"""
|
||||
SELECT * FROM `UserMessageCountPerHour`
|
||||
WHERE `Id` = {id};
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_by_user_id_string(id: int) -> str:
|
||||
return str(f"""
|
||||
SELECT * FROM `UserMessageCountPerHour`
|
||||
WHERE `UserId` = {id};
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def get_select_by_user_id_and_date_string(id: int, date: datetime) -> str:
|
||||
date_str = f'{str(date.year).zfill(4)}-{str(date.month).zfill(2)}-{str(date.day).zfill(2)}%'
|
||||
|
||||
return str(f"""
|
||||
SELECT * FROM `UserMessageCountPerHour`
|
||||
WHERE `UserId` = {id}
|
||||
AND `Date` LIKE '{date_str}'
|
||||
AND `Hour` = {date.hour};
|
||||
""")
|
||||
|
||||
@property
|
||||
def insert_string(self) -> str:
|
||||
return str(f"""
|
||||
INSERT INTO `UserMessageCountPerHour` (
|
||||
`UserId`, `Date`, `Hour`, `XPCount`, `CreatedAt`, `LastModifiedAt`
|
||||
) VALUES (
|
||||
{self._user.user_id},
|
||||
'{self._date}',
|
||||
{self._hour},
|
||||
{self._xp_count},
|
||||
'{self._created_at}',
|
||||
'{self._modified_at}'
|
||||
);
|
||||
""")
|
||||
|
||||
@property
|
||||
def udpate_string(self) -> str:
|
||||
return str(f"""
|
||||
UPDATE `UserMessageCountPerHour`
|
||||
SET `XPCount` = '{self._xp_count}',
|
||||
`LastModifiedAt` = '{self._modified_at}'
|
||||
WHERE `Id` = {self._id};
|
||||
""")
|
||||
|
||||
@property
|
||||
def delete_string(self) -> str:
|
||||
return str(f"""
|
||||
DELETE FROM `UserMessageCountPerHour`
|
||||
WHERE `Id` = {self._id};
|
||||
""")
|
||||
|
||||
@staticmethod
|
||||
def delete_by_user_id_string(id: int) -> str:
|
||||
return str(f"""
|
||||
DELETE FROM `UserMessageCountPerHour`
|
||||
WHERE `UserId` = {id}
|
||||
""")
|
@ -4,7 +4,7 @@ from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_core.logging.database_logger import DatabaseLogger
|
||||
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel
|
||||
|
@ -0,0 +1,101 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_core.logging.database_logger import DatabaseLogger
|
||||
from bot_data.abc.user_message_count_per_hour_repository_abc import UserMessageCountPerHourRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.user_message_count_per_hour import UserMessageCountPerHour
|
||||
|
||||
|
||||
class UserMessageCountPerHourRepositoryService(UserMessageCountPerHourRepositoryABC):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
logger: DatabaseLogger,
|
||||
db_context: DatabaseContextABC,
|
||||
users: UserRepositoryABC,
|
||||
):
|
||||
UserMessageCountPerHourRepositoryABC.__init__(self)
|
||||
|
||||
self._logger = logger
|
||||
self._context = db_context
|
||||
self._users = users
|
||||
|
||||
@staticmethod
|
||||
def _get_value_from_result(value: any) -> Optional[any]:
|
||||
if isinstance(value, str) and 'NULL' in value:
|
||||
return None
|
||||
|
||||
return value
|
||||
|
||||
def _from_result(self, result: tuple) -> UserMessageCountPerHour:
|
||||
return UserMessageCountPerHour(
|
||||
self._get_value_from_result(result[1]),
|
||||
self._get_value_from_result(result[2]),
|
||||
self._get_value_from_result(result[3]),
|
||||
self._users.get_user_by_id(self._get_value_from_result(result[4])),
|
||||
self._get_value_from_result(result[5]),
|
||||
self._get_value_from_result(result[6]),
|
||||
id=self._get_value_from_result(result[0])
|
||||
)
|
||||
|
||||
def get_user_message_count_per_hours(self) -> List[UserMessageCountPerHour]:
|
||||
umcphs = List(UserMessageCountPerHour)
|
||||
self._logger.trace(__name__, f'Send SQL command: {UserMessageCountPerHour.get_select_all_string()}')
|
||||
results = self._context.select(UserMessageCountPerHour.get_select_all_string())
|
||||
for result in results:
|
||||
self._logger.trace(__name__, f'Get user message count per hour with id {result[0]}')
|
||||
umcphs.append(self._from_result(result))
|
||||
|
||||
return umcphs
|
||||
|
||||
def find_user_message_count_per_hour_by_user_id(self, user_id: int) -> List[Optional[UserMessageCountPerHour]]:
|
||||
umcphs = List(UserMessageCountPerHour)
|
||||
sql = UserMessageCountPerHour.get_select_by_user_id_string(user_id)
|
||||
self._logger.trace(__name__, f'Send SQL command: {sql}')
|
||||
results = self._context.select(sql)
|
||||
if results is None or len(results) == 0:
|
||||
return umcphs
|
||||
|
||||
for result in results:
|
||||
self._logger.trace(__name__, f'Get user message count per hour with id {result[0]}')
|
||||
umcphs.append(self._from_result(result))
|
||||
|
||||
return umcphs
|
||||
|
||||
def get_user_message_count_per_hour_by_user_id_and_date(self, user_id: int, date: datetime) -> \
|
||||
UserMessageCountPerHour:
|
||||
sql = UserMessageCountPerHour.get_select_by_user_id_and_date_string(user_id, date)
|
||||
self._logger.trace(__name__, f'Send SQL command: {sql}')
|
||||
result = self._context.select(sql)[0]
|
||||
return self._from_result(result)
|
||||
|
||||
def find_user_message_count_per_hour_by_user_id_and_date(self, user_id: int, date: datetime) -> \
|
||||
Optional[UserMessageCountPerHour]:
|
||||
sql = UserMessageCountPerHour.get_select_by_user_id_and_date_string(user_id, date)
|
||||
self._logger.trace(__name__, f'Send SQL command: {sql}')
|
||||
result = self._context.select(sql)
|
||||
if result is None or len(result) == 0:
|
||||
return None
|
||||
|
||||
return self._from_result(result[0])
|
||||
|
||||
def add_user_message_count_per_hour(self, umcph: UserMessageCountPerHour):
|
||||
self._logger.trace(__name__, f'Send SQL command: {umcph.insert_string}')
|
||||
self._context.cursor.execute(umcph.insert_string)
|
||||
|
||||
def update_user_message_count_per_hour(self, umcph: UserMessageCountPerHour):
|
||||
self._logger.trace(__name__, f'Send SQL command: {umcph.udpate_string}')
|
||||
self._context.cursor.execute(umcph.udpate_string)
|
||||
|
||||
def delete_user_message_count_per_hour(self, umcph: UserMessageCountPerHour):
|
||||
self._logger.trace(__name__, f'Send SQL command: {umcph.delete_string}')
|
||||
self._context.cursor.execute(umcph.delete_string)
|
||||
|
||||
def delete_user_message_count_per_hour_by_user_id(self, user_id: int):
|
||||
sql = UserMessageCountPerHour.delete_by_user_id_string(user_id)
|
||||
self._logger.trace(__name__, f'Send SQL command: {sql}')
|
||||
self._context.cursor.execute(sql)
|
@ -11,7 +11,7 @@ from discord import app_commands, Guild
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -29,7 +29,7 @@ class AutoRoleGroup(DiscordCommandABC):
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe,
|
||||
servers: ServerRepositoryABC,
|
||||
auto_roles: AutoRoleRepositoryABC,
|
||||
|
@ -6,7 +6,7 @@ from discord import VoiceChannel
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -21,7 +21,7 @@ class AFKCommand(DiscordCommandABC):
|
||||
config: ConfigurationABC,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
@ -8,7 +8,7 @@ from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -23,7 +23,7 @@ class HelpCommand(DiscordCommandABC):
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC
|
||||
client_utils: ClientUtilsABC
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
||||
|
@ -9,7 +9,7 @@ from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
import bot
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -23,7 +23,7 @@ class InfoCommand(DiscordCommandABC):
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
@ -5,7 +5,7 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -22,7 +22,7 @@ class PingCommand(DiscordCommandABC):
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe,
|
||||
permissions: PermissionServiceABC,
|
||||
base_helper: BaseHelperABC,
|
||||
|
@ -6,7 +6,7 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.configuration.server_settings import ServerSettings
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
@ -22,7 +22,7 @@ class PurgeCommand(DiscordCommandABC):
|
||||
config: ConfigurationABC,
|
||||
message_service: MessageServiceABC,
|
||||
permissions: PermissionServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe
|
||||
):
|
||||
DiscordCommandABC.__init__(self)
|
||||
|
@ -10,14 +10,14 @@ from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from bot_core.pipes.date_time_offset_pipe import DateTimeOffsetPipe
|
||||
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_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from modules.level.service.level_service import LevelService
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
@ -31,7 +31,7 @@ class UserGroup(DiscordCommandABC):
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
permissions: PermissionServiceABC,
|
||||
servers: ServerRepositoryABC,
|
||||
db: DatabaseContextABC,
|
||||
|
@ -14,6 +14,7 @@ class BaseServerSettings(ConfigurationModelABC):
|
||||
self._max_voice_state_hours: int = 0
|
||||
self._xp_per_message: int = 0
|
||||
self._xp_per_reaction: int = 0
|
||||
self._max_message_xp_per_hour: int = 0
|
||||
self._xp_per_ontime_hour: int = 0
|
||||
self._afk_channel_ids: List[int] = List(int)
|
||||
self._afk_command_channel_id: int = 0
|
||||
@ -37,6 +38,10 @@ class BaseServerSettings(ConfigurationModelABC):
|
||||
def xp_per_reaction(self) -> int:
|
||||
return self._xp_per_reaction
|
||||
|
||||
@property
|
||||
def max_message_xp_per_hour(self) -> int:
|
||||
return self._max_message_xp_per_hour
|
||||
|
||||
@property
|
||||
def xp_per_ontime_hour(self) -> int:
|
||||
return self._xp_per_ontime_hour
|
||||
@ -67,6 +72,7 @@ class BaseServerSettings(ConfigurationModelABC):
|
||||
self._max_voice_state_hours = int(settings['MaxVoiceStateHours'])
|
||||
self._xp_per_message = int(settings['XpPerMessage'])
|
||||
self._xp_per_reaction = int(settings['XpPerReaction'])
|
||||
self._max_message_xp_per_hour = int(settings['MaxMessageXpPerHour'])
|
||||
self._xp_per_ontime_hour = int(settings['XpPerOntimeHour'])
|
||||
for index in settings['AFKChannelIds']:
|
||||
self._afk_channel_ids.append(int(index))
|
||||
|
@ -8,6 +8,7 @@ from cpl_discord.service import DiscordBotServiceABC
|
||||
from bot_core.helper.event_checks import EventChecks
|
||||
from bot_core.helper.log_message_helper import LogMessageHelper
|
||||
from bot_core.logging.message_logger import MessageLogger
|
||||
from bot_core.service.client_utils_service import ClientUtilsService
|
||||
from bot_data.abc.client_repository_abc import ClientRepositoryABC
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
@ -22,6 +23,7 @@ class BaseOnMessageEvent(OnMessageABC):
|
||||
self,
|
||||
logger: MessageLogger,
|
||||
bhs: BaseHelperABC,
|
||||
client_utils: ClientUtilsService,
|
||||
db: DatabaseContextABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
users: UserRepositoryABC,
|
||||
@ -31,6 +33,8 @@ class BaseOnMessageEvent(OnMessageABC):
|
||||
OnMessageABC.__init__(self)
|
||||
self._logger = logger
|
||||
self._base_helper = bhs
|
||||
self._client_utils = client_utils
|
||||
self._bot = bot
|
||||
self._db = db
|
||||
self._bot = bot
|
||||
self._users = users
|
||||
@ -64,6 +68,9 @@ class BaseOnMessageEvent(OnMessageABC):
|
||||
return
|
||||
|
||||
settings: BaseServerSettings = self._base_helper.get_config(message.guild.id)
|
||||
if self._client_utils.is_message_xp_count_by_hour_higher_that_max_message_count_per_hour(message.created_at, user, settings):
|
||||
return
|
||||
|
||||
old_xp = user.xp
|
||||
user.xp += settings.xp_per_message
|
||||
self._users.update_user(user)
|
||||
@ -71,6 +78,8 @@ class BaseOnMessageEvent(OnMessageABC):
|
||||
|
||||
self._logger.debug(__name__, f'User {user} sent message. xp: from {old_xp} to {user.xp}')
|
||||
|
||||
|
||||
|
||||
@EventChecks.check_is_ready()
|
||||
async def on_message(self, message: discord.Message):
|
||||
self._logger.debug(__name__, f'Module {type(self)} started')
|
||||
|
@ -12,7 +12,7 @@ from bot_core.helper.event_checks import EventChecks
|
||||
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
|
||||
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.server import Server
|
||||
from bot_data.model.user import User
|
||||
|
@ -1,8 +1,11 @@
|
||||
from datetime import datetime
|
||||
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
from cpl_core.logging import LoggerABC
|
||||
from cpl_discord.service import DiscordBotServiceABC
|
||||
from discord import RawReactionActionEvent
|
||||
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.helper.log_message_helper import LogMessageHelper
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
@ -19,6 +22,7 @@ class BaseReactionHandler:
|
||||
servers: ServerRepositoryABC,
|
||||
users: UserRepositoryABC,
|
||||
base_helper: BaseHelperABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
db: DatabaseContextABC,
|
||||
):
|
||||
self._logger = logger
|
||||
@ -26,6 +30,7 @@ class BaseReactionHandler:
|
||||
self._servers = servers
|
||||
self._users = users
|
||||
self._base_helper = base_helper
|
||||
self._client_utils = client_utils
|
||||
self._db = db
|
||||
|
||||
async def handle(self, payload: RawReactionActionEvent, r_type=None) -> None:
|
||||
@ -59,6 +64,11 @@ class BaseReactionHandler:
|
||||
settings: BaseServerSettings = self._base_helper.get_config(guild.id)
|
||||
|
||||
if r_type == 'add':
|
||||
if self._client_utils.is_message_xp_count_by_hour_higher_that_max_message_count_per_hour(
|
||||
datetime.now(), user, settings, is_reaction=True
|
||||
):
|
||||
return
|
||||
|
||||
user.xp += settings.xp_per_reaction
|
||||
self._users.update_user(user)
|
||||
self._db.save_changes()
|
||||
|
@ -12,7 +12,7 @@ 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
|
||||
from bot_data.abc.user_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.client import Client
|
||||
from bot_data.model.known_user import KnownUser
|
||||
|
@ -10,7 +10,7 @@ from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -30,7 +30,7 @@ class LevelGroup(DiscordCommandABC):
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
permission_service: PermissionServiceABC,
|
||||
translate: TranslatePipe,
|
||||
db: DatabaseContextABC,
|
||||
|
@ -8,7 +8,7 @@ from discord import app_commands
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
@ -25,7 +25,7 @@ class StatsGroup(DiscordCommandABC):
|
||||
self,
|
||||
logger: CommandLogger,
|
||||
message_service: MessageServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe,
|
||||
permission_service: PermissionServiceABC,
|
||||
statistic: StatisticService,
|
||||
|
@ -10,7 +10,7 @@ from bot_data.abc.known_user_repository_abc import KnownUserRepositoryABC
|
||||
from bot_data.abc.level_repository_abc import LevelRepositoryABC
|
||||
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_joined_voice_channel_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
|
||||
from bot_data.abc.user_repository_abc import UserRepositoryABC
|
||||
from bot_data.model.auto_role import AutoRole
|
||||
from bot_data.model.client import Client
|
||||
|
@ -13,7 +13,7 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.custom_file_logger_abc import CustomFileLoggerABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
@ -29,7 +29,7 @@ class LogCommand(DiscordCommandABC):
|
||||
logging_settings: LoggingSettings,
|
||||
services: ServiceProviderABC,
|
||||
message_service: MessageServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe,
|
||||
permissions: PermissionServiceABC,
|
||||
time_format: TimeFormatSettings,
|
||||
|
@ -7,7 +7,7 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.configuration.bot_settings import BotSettings
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
@ -23,7 +23,7 @@ class RestartCommand(DiscordCommandABC):
|
||||
config: ConfigurationABC,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe,
|
||||
permissions: PermissionServiceABC,
|
||||
settings: BotSettings
|
||||
|
@ -8,7 +8,7 @@ from cpl_translation import TranslatePipe
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.client_utils_abc import ClientUtilsABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.configuration.bot_settings import BotSettings
|
||||
from bot_core.helper.command_checks import CommandChecks
|
||||
@ -24,7 +24,7 @@ class ShutdownCommand(DiscordCommandABC):
|
||||
config: ConfigurationABC,
|
||||
message_service: MessageServiceABC,
|
||||
bot: DiscordBotServiceABC,
|
||||
client_utils: ClientUtilsServiceABC,
|
||||
client_utils: ClientUtilsABC,
|
||||
translate: TranslatePipe,
|
||||
permissions: PermissionServiceABC,
|
||||
settings: BotSettings
|
||||
|
Loading…
Reference in New Issue
Block a user