Skip to content

Commit

Permalink
Fix/mention types (#344)
Browse files Browse the repository at this point in the history
* fix: Entity id type, mention types imports.

* style: `__all__` order.
  • Loading branch information
kutuzov13 authored Apr 14, 2022
1 parent b4cf390 commit 2ba86cf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
30 changes: 22 additions & 8 deletions pybotx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@
UserSender,
)
from pybotx.models.message.markup import BubbleMarkup, Button, KeyboardMarkup
from pybotx.models.message.mentions import Mention, MentionBuilder, MentionList
from pybotx.models.message.mentions import (
Mention,
MentionAll,
MentionBuilder,
MentionChannel,
MentionChat,
MentionContact,
MentionList,
MentionUser,
)
from pybotx.models.message.message_status import MessageStatus
from pybotx.models.message.outgoing_message import OutgoingMessage
from pybotx.models.message.reply import Reply
Expand All @@ -96,18 +105,20 @@
"AnswerDestinationLookupError",
"AttachmentTypes",
"Bot",
"BotAccountWithSecret",
"BotAPIBotDisabledResponse",
"BotAPIMethodFailedCallback",
"BotAccount",
"BotAccountWithSecret",
"BotIsNotChatMemberError",
"BotMenu",
"BotAccount",
"BotSender",
"BotShuttingDownError",
"BotXMethodCallbackNotFoundError",
"BotXMethodFailedCallbackReceivedError",
"BubbleMarkup",
"Button",
"CTSLoginEvent",
"CTSLogoutEvent",
"CallbackNotReceivedError",
"CantUpdatePersonalChatError",
"Chat",
Expand All @@ -121,12 +132,10 @@
"ChatNotFoundError",
"ChatTypes",
"ClientPlatforms",
"CTSLoginEvent",
"CTSLogoutEvent",
"DeletedFromChatEvent",
"Document",
"EditMessage",
"MessageStatus",
"EventNotFoundError",
"File",
"FileDeletedError",
"FileMetadataNotFound",
Expand All @@ -143,13 +152,18 @@
"InvalidEmojiError",
"InvalidImageError",
"InvalidUsersListError",
"EventNotFoundError",
"KeyboardMarkup",
"LeftFromChatEvent",
"Mention",
"MentionAll",
"MentionBuilder",
"MentionChannel",
"MentionChat",
"MentionContact",
"MentionList",
"MentionTypes",
"MentionUser",
"MessageStatus",
"Middleware",
"OutgoingAttachment",
"OutgoingMessage",
Expand All @@ -165,8 +179,8 @@
"StickerPack",
"StickerPackOrStickerNotFoundError",
"UnknownBotAccountError",
"UnsupportedBotAPIVersionError",
"UnknownSystemEventError",
"UnsupportedBotAPIVersionError",
"UserDevice",
"UserFromSearch",
"UserKinds",
Expand Down
10 changes: 5 additions & 5 deletions pybotx/models/message/mentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def build_embed_mention(

@dataclass
class BaseTargetMention:
entity_id: Optional[UUID]
entity_id: UUID
name: Optional[str]


Expand Down Expand Up @@ -82,7 +82,7 @@ def __str__(self) -> str:

class MentionBuilder:
@classmethod
def user(cls, entity_id: Optional[UUID], name: Optional[str] = None) -> MentionUser:
def user(cls, entity_id: UUID, name: Optional[str] = None) -> MentionUser:
return MentionUser(
type=MentionTypes.USER,
entity_id=entity_id,
Expand All @@ -92,7 +92,7 @@ def user(cls, entity_id: Optional[UUID], name: Optional[str] = None) -> MentionU
@classmethod
def contact(
cls,
entity_id: Optional[UUID],
entity_id: UUID,
name: Optional[str] = None,
) -> MentionContact:
return MentionContact(
Expand All @@ -102,7 +102,7 @@ def contact(
)

@classmethod
def chat(cls, entity_id: Optional[UUID], name: Optional[str] = None) -> MentionChat:
def chat(cls, entity_id: UUID, name: Optional[str] = None) -> MentionChat:
return MentionChat(
type=MentionTypes.CHAT,
entity_id=entity_id,
Expand All @@ -112,7 +112,7 @@ def chat(cls, entity_id: Optional[UUID], name: Optional[str] = None) -> MentionC
@classmethod
def channel(
cls,
entity_id: Optional[UUID],
entity_id: UUID,
name: Optional[str] = None,
) -> MentionChannel:
return MentionChannel(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybotx"
version = "0.34.0"
version = "0.34.1"
description = "A python library for interacting with eXpress BotX API"
authors = [
"Sidnev Nikolay <[email protected]>",
Expand Down

2 comments on commit 2ba86cf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://pybotx.netlify.app as production
🚀 Deployed on https://625808f5ac23d5012c37e964--pybotx.netlify.app

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.