forked from sh-edraft.de/sh_discord_bot
Added stats table #46
This commit is contained in:
@@ -13,8 +13,8 @@ from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from bot_data.abc.server_repository_abc import ServerRepositoryABC
|
||||
from bot_data.model.statistic import Statistic
|
||||
from modules.permission.abc.permission_service_abc import PermissionServiceABC
|
||||
from modules.stats.model.statistic import Statistic
|
||||
from modules.stats.service.statistic_service import StatisticService
|
||||
from modules.stats.ui.add_statistic_form import AddStatisticForm
|
||||
|
||||
|
@@ -1,29 +0,0 @@
|
||||
from typing import Callable
|
||||
|
||||
|
||||
class Statistic:
|
||||
|
||||
def __init__(self, name: str, description: str, code: str):
|
||||
self._name = name
|
||||
self._description = description
|
||||
self._code = code
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return self._description
|
||||
|
||||
@description.setter
|
||||
def description(self, value: str):
|
||||
self._description = value
|
||||
|
||||
@property
|
||||
def code(self) -> str:
|
||||
return self._code
|
||||
|
||||
@code.setter
|
||||
def code(self, value: str):
|
||||
self._code = value
|
@@ -5,7 +5,7 @@ from discord import ui, TextStyle
|
||||
|
||||
from bot_core.abc.message_service_abc import MessageServiceABC
|
||||
from bot_core.logging.command_logger import CommandLogger
|
||||
from modules.stats.model.statistic import Statistic
|
||||
from modules.stats.model.statisticmodel import StatisticModel
|
||||
|
||||
|
||||
class AddStatisticForm(ui.Modal):
|
||||
@@ -15,7 +15,7 @@ class AddStatisticForm(ui.Modal):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
stats: List[Statistic],
|
||||
stats: List[StatisticModel],
|
||||
name: str,
|
||||
message_service: MessageServiceABC,
|
||||
logger: CommandLogger,
|
||||
@@ -41,7 +41,7 @@ class AddStatisticForm(ui.Modal):
|
||||
statistic = self._stats.where(lambda s: s.name == self._name).single_or_default()
|
||||
try:
|
||||
if statistic is None:
|
||||
self._stats.append(Statistic(self._name, self.description.value, self.code.value))
|
||||
self._stats.append(StatisticModel(self._name, self.description.value, self.code.value))
|
||||
await self._message_service.send_interaction_msg(interaction, self._t.transform('modules.stats.add.success'))
|
||||
return
|
||||
|
||||
|
Reference in New Issue
Block a user