mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-13 10:34:28 +05:00
refactor: add defaults to Message and center property
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass, field
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from core.logger import DialogType, Logger
|
from core.logger import DialogType, Logger
|
||||||
@@ -16,9 +16,10 @@ from core.types.color import Color
|
|||||||
|
|
||||||
@dataclass()
|
@dataclass()
|
||||||
class Message:
|
class Message:
|
||||||
title: str
|
title: str = field(default="")
|
||||||
text: List[str]
|
text: List[str] = field(default_factory=list)
|
||||||
color: Color
|
color: Color = field(default=Color.WHITE)
|
||||||
|
centered: bool = field(default=False)
|
||||||
|
|
||||||
|
|
||||||
class MessageService:
|
class MessageService:
|
||||||
@@ -49,6 +50,7 @@ class MessageService:
|
|||||||
content=self.message.text,
|
content=self.message.text,
|
||||||
custom_title=self.message.title,
|
custom_title=self.message.title,
|
||||||
custom_color=self.message.color,
|
custom_color=self.message.color,
|
||||||
|
center_content=self.message.centered,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.__clear_message()
|
self.__clear_message()
|
||||||
|
|||||||
Reference in New Issue
Block a user