Fixed user selected emoji bug

This commit is contained in:
Profitroll 2023-08-12 22:36:26 +02:00
parent eadbdd1eda
commit aee5cdf6a5
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
2 changed files with 9 additions and 2 deletions

View File

@ -85,6 +85,10 @@ class PyroUser:
logger.debug("%s's mistakes count has been set to %s", self.id, mistakes) logger.debug("%s's mistakes count has been set to %s", self.id, mistakes)
await col_users.update_one({"_id": self._id}, {"$set": {"mistakes": mistakes}}) await col_users.update_one({"_id": self._id}, {"$set": {"mistakes": mistakes}})
async def set_selected(self, emojis: List[str] = None) -> None:
logger.debug("%s's elected emojis have been set to %s", self.id, emojis)
await col_users.update_one({"_id": self._id}, {"$set": {"selected": emojis}})
async def update_score(self, points: int = 1) -> None: async def update_score(self, points: int = 1) -> None:
logger.debug("%s point(s) have been added to %s score", points, self.id) logger.debug("%s point(s) have been added to %s score", points, self.id)
await col_users.update_one( await col_users.update_one(

View File

@ -69,6 +69,9 @@ async def handler_user_join(app: PyroClient, message: Message):
await user.set_score(0) await user.set_score(0)
await user.set_mistakes(0) await user.set_mistakes(0)
if len(user.selected) > 0:
await user.set_selected([])
await asyncio.sleep(2) await asyncio.sleep(2)
verification_request = await app.send_message( verification_request = await app.send_message(
chat_id=group.id, chat_id=group.id,
@ -80,13 +83,13 @@ async def handler_user_join(app: PyroClient, message: Message):
[ [
InlineKeyboardButton( InlineKeyboardButton(
app._("verify", "buttons", locale=locale), app._("verify", "buttons", locale=locale),
callback_data=f"verify;{user.id}", callback_data=f"verify:{user.id}",
) )
], ],
[ [
InlineKeyboardButton( InlineKeyboardButton(
app._("ban", "buttons", locale=locale), app._("ban", "buttons", locale=locale),
callback_data=f"ban;{user.id}", callback_data=f"ban:{user.id}",
) )
], ],
], ],