Skip to content

Commit

Permalink
fix: forward_message not parsing properly
Browse files Browse the repository at this point in the history
  • Loading branch information
New-dev0 committed May 1, 2024
1 parent 2478e39 commit 512b8b4
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name="swibots",
version="1.4.40",
version="1.4.41",
packages=find_packages(exclude=["samples", "bots_impl", "docs"]),
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
6 changes: 3 additions & 3 deletions swibots/api/callback/AppPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
show_continue: bool = True,
back_action: str = None,
disable_appbar: bool = False,
max_size: bool = None,
max_size: bool = True,
**kwargs
):
super().__init__(app)
Expand All @@ -79,7 +79,7 @@ def to_json(self) -> JSONDict:
components = []
for component in self.components:
if isinstance(component, ListView):
if self.max_size != None and component.max_size == None:
if self.max_size != None:
component.max_size = self.max_size
parsed = component.to_json_request()
if isinstance(parsed, list):
Expand All @@ -88,7 +88,7 @@ def to_json(self) -> JSONDict:
components.append(parsed)
elif isinstance(component, Component):
componentJson = component.to_json()
if "mainAxisSize" not in componentJson and self.max_size != None:
if self.max_size != None:
componentJson["mainAxisSize"] = "max" if self.max_size else "min"
components.append(componentJson)

Expand Down
4 changes: 2 additions & 2 deletions swibots/api/callback/Button.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(
callback_data: Optional[str] = None,
color: str = None,
variant: ButtonVariant = ButtonVariant.DEFAULT,
max_size: bool = False,
max_size: bool = None,
**kwargs
):
if isinstance(text, str):
Expand Down Expand Up @@ -109,7 +109,7 @@ def __init__(
class ButtonGroup(Component):
type = "button_group"

def __init__(self, buttons: List[Button], max_size: bool = False):
def __init__(self, buttons: List[Button], max_size: bool = None):
self.buttons = buttons
self.max_size = max_size

Expand Down
2 changes: 1 addition & 1 deletion swibots/api/callback/Dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(
selected: int = None,
options: List[ListItem] = None,
disabled: bool = None,
max_size: bool = False
max_size: bool = None
):
self.disabled = disabled
self.options = options
Expand Down
4 changes: 2 additions & 2 deletions swibots/api/callback/Inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(
left_icon: Optional[Icon] = None,
multiline: bool = False,
expanded: bool = False,
max_size: bool = False
max_size: bool = None
):
self.label = label
self.width = width
Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(
callback_data: str,
files_count: int = 1,
mime_type: List[str] = ["png", "jpg", "jpeg", "webp"],
max_size: bool = False
max_size: bool = None
):
self.callback_data = callback_data
self.files_count = files_count
Expand Down
2 changes: 1 addition & 1 deletion swibots/api/callback/ListView.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
callback_data: str = "",
thumb: Union[Image, str] = "",
badges: List[Badge] = None,
max_size: bool = False
max_size: bool = None
):
self.title = title
self.subtitle = subtitle
Expand Down
4 changes: 2 additions & 2 deletions swibots/api/callback/Players.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(
callback_data: str = None,
previous_callback: Optional[str] = "",
next_callback: Optional[str] = "",
max_size: bool = False
max_size: bool = None
):
self.title = title
self.url = url
Expand Down Expand Up @@ -55,7 +55,7 @@ def __init__(
full_screen: bool = False,
badges: List[Badge] = None,
callback_data: str = None,
max_size: bool = False
max_size: bool = None

):
self.url = url
Expand Down
2 changes: 1 addition & 1 deletion swibots/api/callback/Search.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SearchHolder(Component):

def __init__(
self, placeholder: str = "Search..", callback_data: Optional[str] = None,
max_size: bool = False
max_size: bool = None
):
self.placeholder = placeholder
self.callback_data = callback_data
Expand Down
4 changes: 2 additions & 2 deletions swibots/api/callback/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(
size: TextSize = TextSize.BODY,
opacity: float = 1,
color: str = None,
max_size: bool = False,
max_size: bool = None,
):
self.text = text
self.size = size
Expand All @@ -79,7 +79,7 @@ def __init__(
url: str,
callback_data: str = None,
dark_url: str = None,
max_size: bool = False,
max_size: bool = None,
):
self.url = url
self.callback_data = callback_data
Expand Down
10 changes: 5 additions & 5 deletions swibots/api/chat/controllers/message_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,10 @@ async def forward_message(
group_channel = group_channel.id
elif group_channel is not None:
group_channel = group_channel
message_id_list = isinstance(message_id, list)

if isinstance(message_id, list):
message_id = ",".join(message_id)
if message_id_list:
message_id = ",".join(map(str, message_id))

q = []
if group_channel is not None:
Expand All @@ -433,9 +434,8 @@ async def forward_message(

log.debug("Forwarding message %s", id)
response = await self.client.put(f"{BASE_PATH}/forward/{message_id}?{strQuery}")
if isinstance(response.data, list):
message = self.client.build_list(Message, response.data)
if isinstance(message_id, list):
message = self.client.build_list(Message, [data.get("message") for data in response.data])
if message_id_list:
return message
return message[0] if message else None

Expand Down

0 comments on commit 512b8b4

Please sign in to comment.