Closed eternnoir closed 8 years ago
Can you leave and example using inline keyboard button, callback query and edit message text?
Hi! I have a problem with this implementation of your fucking amazing library.
I've copy the error code here to minimize this text: http://pastebin.com/9uNBk3K0
I'm not sure if there is a problem with version compatibility or if this is a bug in your library, but I think the line where I find the error is ok...
Thank you!
@Thorapio Try to update python-requests pip install -U requests
.
@eternnoir , it doesn't seems to work for me... Here I paste the result of update the requests (http://pastebin.com/DRgVS2d0) and here are 2 more errors that appears to me two time when I was testing after update the requests (http://pastebin.com/DRgVS2d0). Futhermore, the first error is still happening and I don't know if I'm doing something wrong...
Thanks for your response!
That error happens when you previously installed requests with apt
.
Try uninstalling the requests package with apt
: apt-get remove python-requests*
, and then reinstalling the package with pip
: pip install requests
.
There is a typo in the name of the method: "bot.edit_message_replay_markup()"
Correct is: "bot.editmessagereply_markup()"
v. 2.0.1
Is there any way so send multiple inline buttons with only one message? Like this: http://prntscr.com/awi4dg
@MonsterDeveloper, types.InlineKeyboardMarkup()
suppose to do that, but for some reasons it doesn't work for me. Telegram sends:
2016-04-25 11:22:39,174 (__init__.py:211 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"[Error]: Bad Request: Can\'t parse inline keyboard button: InlineKeyboardButton should be an Object"}']"
@thakryptex Oh. Originally, I use that code: http://pastebin.com/AsN6qrum. I tried this: http://pastebin.com/6D4jaMz6 but no succes
@MonsterDeveloper, yeah, i've tried this too.
and i tried to do markup.row('button1', 'button2')
as it works for the simple markup keyboard, but it has no effect too.
@thakryptex Well, I think there is no way to do that. Waiting for @eternnoir answer right now)
@thakryptex typo already fixed.
About Is there any way so send multiple inline buttons with only one message?
Try this
@bot.message_handler(commands=['start', 'help'])
def command_help(message):
markup = types.InlineKeyboardMarkup()
itembtna = types.InlineKeyboardButton('a', switch_inline_query="")
itembtnv = types.InlineKeyboardButton('v', switch_inline_query="")
itembtnc = types.InlineKeyboardButton('c', switch_inline_query="")
markup.row(itembtna)
markup.row(itembtnv, itembtnc)
bot.send_message(message.chat.id, "Choose one letter:", reply_markup=markup)
Don't forgot update pyTelegramBotAPI version.
@thakryptex
2016-04-25 11:22:39,174 (__init__.py:211 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"[Error]: Bad Request: Can\'t parse inline keyboard button: InlineKeyboardButton should be an Object"}']"
The reason for this error is that you didn't use any option fields in InlineKeyboardButton. The develop doc says You must use exactly one of the optional fields.
https://core.telegram.org/bots/api#inlinekeyboardbutton
@eternnoir Thank you! I will try it when I come home)
@eternnoir Thanks! That worked for me!
@eternnoir oh, thanks, now I understand what was wrong.
@eternnoir
Appreciate your work man!
RegardingAbout Is there any way so send multiple inline buttons with only one message? Try this
How can I add reply_to to the InlinekeyboardButton?
this show only buttons:
msg = bot.reply_to(m, "Send me your url:")
markup = types.InlineKeyboardMarkup()
itembtna = types.InlineKeyboardButton('a', callback_data="ds")
itembtnv = types.InlineKeyboardButton('v', callback_data="sds")
itembtnc = types.InlineKeyboardButton('c', callback_data="sdss")
markup.row(itembtna)
markup.row(itembtnv, itembtnc)
but how we should set callback query handler for inline buttons?
How about sendGame method? https://core.telegram.org/bots/api#sendgame
Install pyTelegramBotAPI bot 2.0 branch
Bot 2.0 Implementation Status
New Types
New Methods
Inline bots
Bug repor.
Feel free to report bugs about this branch. https://github.com/eternnoir/pyTelegramBotAPI/issues/130