Skip to content

Commit

Permalink
Merge pull request #21 from quillcraftsman/bugs
Browse files Browse the repository at this point in the history
fix reply bug
  • Loading branch information
quillcraftsman authored Jan 28, 2025
2 parents 396fcc7 + daab717 commit 6cd465d
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Отчет об ошибке
name: Отчет об ошибке (Bub Report)
about: Создайте отчет об ошибке, чтобы мы её исправили
title: ''
labels: ''
Expand Down
2 changes: 1 addition & 1 deletion telegram_framework/chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def add_bot(chat: Chat, bot: Any) -> Chat:

def add_message(chat: Chat, message: Any) -> Chat:
chat_message = message
if not isinstance(chat_message, messages.ChatMessageBase):
if not messages.is_chat_message(chat_message):
chat_message = messages.create_chat_message(chat_message, chat)
new_messages = chat.messages + [chat_message]
chat = update(chat, messages=new_messages)
Expand Down
2 changes: 1 addition & 1 deletion telegram_framework/messages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .message import Message
from .reply import Reply, create_reply
from .chat_message import ChatMessage, create_chat_message
from .chat_message_base import ChatMessageBase
from .chat_message_base import is_chat_message
4 changes: 4 additions & 0 deletions telegram_framework/messages/chat_message_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
@dataclass(frozen=True)
class ChatMessageBase(MessageBase):
chat: Any


def is_chat_message(message):
return hasattr(message, 'chat')
6 changes: 3 additions & 3 deletions telegram_framework/messages/reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .errors import MessageNotInChatError
from .message_default import MessageDefault
from .reply_base import ReplyBase
from .chat_message_base import ChatMessageBase
from .chat_message_base import is_chat_message


@dataclass(frozen=True)
Expand All @@ -18,8 +18,8 @@ def __eq__(self, other):



def create_reply(message: ChatMessageBase, text:str, sender: Any) -> Reply:
if not isinstance(message, ChatMessageBase):
def create_reply(message, text:str, sender: Any) -> Reply:
if not is_chat_message(message):
raise MessageNotInChatError(message)

return Reply(
Expand Down
2 changes: 1 addition & 1 deletion telegram_framework/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
Package info
"""
name = 'django-telegram-framework'
version = '1.0.0'
version = '1.0.1'
status = '3 - Alpha'

0 comments on commit 6cd465d

Please sign in to comment.