feat: add notify system to tg
This commit is contained in:
@@ -1 +1,2 @@
|
||||
from src.application.contracts.i_logger import ILogger
|
||||
from src.application.contracts.i_logger import ILogger
|
||||
from src.application.contracts.i_sender_bot import ISenderBot
|
||||
11
src/application/contracts/i_sender_bot.py
Normal file
11
src/application/contracts/i_sender_bot.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class ISenderBot(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def send(
|
||||
self,
|
||||
text: str,
|
||||
) -> None:
|
||||
raise NotImplementedError
|
||||
@@ -1,2 +1,3 @@
|
||||
from src.application.domain.enums.log_level import LogLevel
|
||||
from src.application.domain.enums.log_format import LogFormat
|
||||
from src.application.domain.enums.log_format import LogFormat
|
||||
from src.application.domain.enums.notify_type import NotifyType
|
||||
50
src/application/domain/enums/notify_type.py
Normal file
50
src/application/domain/enums/notify_type.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class NotifyType(Enum):
|
||||
DOCS = 10
|
||||
PURCHASE = 20
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"[{self.value}, '{self.name}']"
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if isinstance(other, NotifyType):
|
||||
return self.value == other.value
|
||||
if isinstance(other, int):
|
||||
return self.value == other
|
||||
return NotImplemented
|
||||
|
||||
def __ne__(self, other: object) -> bool:
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __lt__(self, other: object) -> bool:
|
||||
if isinstance(other, NotifyType):
|
||||
return self.value < other.value
|
||||
if isinstance(other, int):
|
||||
return self.value < other
|
||||
return NotImplemented
|
||||
|
||||
def __le__(self, other: object) -> bool:
|
||||
if isinstance(other, NotifyType):
|
||||
return self.value <= other.value
|
||||
if isinstance(other, int):
|
||||
return self.value <= other
|
||||
return NotImplemented
|
||||
|
||||
def __gt__(self, other: object) -> bool:
|
||||
if isinstance(other, NotifyType):
|
||||
return self.value > other.value
|
||||
if isinstance(other, int):
|
||||
return self.value > other
|
||||
return NotImplemented
|
||||
|
||||
def __ge__(self, other: object) -> bool:
|
||||
if isinstance(other, NotifyType):
|
||||
return self.value >= other.value
|
||||
if isinstance(other, int):
|
||||
return self.value >= other
|
||||
return NotImplemented
|
||||
Reference in New Issue
Block a user