webhook code update
This commit is contained in:
@@ -4,25 +4,27 @@ from tgbot.storage import Profile, storage
|
||||
|
||||
|
||||
def update_button(chat_id, member_id, text='❤️'):
|
||||
print('update reply markup')
|
||||
prevmsg_id = storage.get(f'btn-{chat_id}-{member_id}')
|
||||
if prevmsg_id:
|
||||
premsg_id = prevmsg_id.decode('utf-8')
|
||||
newcomer = Profile.get(member_id)
|
||||
amount = len(newcomer['parents']) + 1
|
||||
text += f' {amount}'
|
||||
rm = {
|
||||
"inline_keyboard": [
|
||||
[
|
||||
{
|
||||
"text": text,
|
||||
"callback_data": 'vouch' + member_id
|
||||
}
|
||||
button_message_id = storage.get(f'btn-{chat_id}-{member_id}')
|
||||
print(f'button_message_id: {button_message_id}')
|
||||
if button_message_id:
|
||||
button_message_id = button_message_id.decode('utf-8')
|
||||
print(f'button_message_id: {button_message_id}')
|
||||
print('update reply markup')
|
||||
newcomer = Profile.get(member_id)
|
||||
amount = len(newcomer['parents']) + 1
|
||||
text += f' {amount}'
|
||||
rm = {
|
||||
"inline_keyboard": [
|
||||
[
|
||||
{
|
||||
"text": text,
|
||||
"callback_data": 'vouch' + member_id
|
||||
}
|
||||
]
|
||||
]
|
||||
]
|
||||
}
|
||||
r = edit_replymarkup(chat_id, prevmsg_id, reply_markup=rm)
|
||||
print(r)
|
||||
}
|
||||
r = edit_replymarkup(chat_id, button_message_id, reply_markup=rm)
|
||||
print(r)
|
||||
|
||||
|
||||
def handle_button(callback_query):
|
||||
|
Reference in New Issue
Block a user