Esempio n. 1
0
async def pluralization_handler(message: types.Message):
    if not users_clicks.get(message.from_user.id):
        users_clicks[message.from_user.id] = 0
    clicks = users_clicks[message.from_user.id]

    text = __(singular="You have {number} click",
              plural="You have {number} clicks",
              n=clicks)
    text = _("This is clicker.\n\n") + text.format(number=clicks)

    await bot.send_message(message.chat.id,
                           text,
                           reply_markup=keyboards.clicker_keyboard(_))
Esempio n. 2
0
def click_handler(call: types.CallbackQuery):
    if not users_clicks.get(call.from_user.id):
        users_clicks[call.from_user.id] = 1
    else:
        users_clicks[call.from_user.id] += 1

    clicks = users_clicks[call.from_user.id]

    text = __(singular="You have {number} click",
              plural="You have {number} clicks",
              n=clicks)
    text = _("This is clicker.\n\n") + text.format(number=clicks)
    bot.edit_message_text(text,
                          call.from_user.id,
                          call.message.message_id,
                          reply_markup=keyboards.clicker_keyboard(_))