Fix empty reply markup patcher

pull/1/head
hikariatama 2022-07-27 17:54:55 +00:00
parent 56e0430f70
commit 6ebfa3e0d7
1 changed files with 7 additions and 3 deletions

View File

@ -53,6 +53,10 @@ VERIFICATION_EMOJIES = list(
) )
class Placeholder:
"""Placeholder"""
class Form(InlineUnit): class Form(InlineUnit):
async def form( async def form(
self, self,
@ -239,10 +243,10 @@ class Form(InlineUnit):
and not ttl and not ttl
): ):
logger.debug("Patching form reply markup with empty data") logger.debug("Patching form reply markup with empty data")
base_reply_markup = reply_markup.copy() base_reply_markup = copy.deepcopy(reply_markup) or None
reply_markup = self._validate_markup({"text": "­", "data": "­"}) reply_markup = self._validate_markup({"text": "­", "data": "­"})
else: else:
base_reply_markup = None base_reply_markup = Placeholder()
if ( if (
not any( not any(
@ -332,7 +336,7 @@ class Form(InlineUnit):
msg = InlineMessage(self, unit_id, inline_message_id) msg = InlineMessage(self, unit_id, inline_message_id)
if base_reply_markup: if not isinstance(base_reply_markup, Placeholder):
await msg.edit(text, reply_markup=base_reply_markup) await msg.edit(text, reply_markup=base_reply_markup)
return msg return msg