Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyTelegramBotAPI Bot2.0 Implementation status. #130

Closed
32 tasks done
eternnoir opened this issue Apr 14, 2016 · 18 comments
Closed
32 tasks done

pyTelegramBotAPI Bot2.0 Implementation status. #130

eternnoir opened this issue Apr 14, 2016 · 18 comments

Comments

@eternnoir
Copy link
Owner

eternnoir commented Apr 14, 2016

Install pyTelegramBotAPI bot 2.0 branch

$ git clone -b bot20 --single-branch https://github.com/eternnoir/pyTelegramBotAPI.git
$ cd pyTelegramBotAPI
$ python setup.py install
  • This branch has not been well tested. Still under beta.

Bot 2.0 Implementation Status

New Types

  • InlineKeyboardMarkup
  • InlineKeyboardButton
  • CallbackQuery
  • MessageEntity
  • Venue

New Methods

  • answerCallbackQuery
  • editMessageText
  • editMessageCaption
  • editMessageReplyMarkup
  • sendVenue
  • sendContact
  • kickChatMember
  • unbanChatMember

Inline bots

  • InlineQueryResultCachedAudio
  • InlineQueryResultCachedDocument
  • InlineQueryResultCachedGif
  • InlineQueryResultCachedMpeg4Gif
  • InlineQueryResultCachedPhoto
  • InlineQueryResultCachedSticker
  • InlineQueryResultCachedVideo
  • InlineQueryResultCachedVoice
  • InlineQueryResultArticle
  • InlineQueryResultAudio
  • InlineQueryResultContact
  • InlineQueryResultDocument
  • InlineQueryResultGif
  • InlineQueryResultLocation
  • InlineQueryResultMpeg4Gif
  • InlineQueryResultPhoto
  • InlineQueryResultVenue
  • InlineQueryResultVideo
  • InlineQueryResultVoice

Bug repor.

Feel free to report bugs about this branch.
#130

@MonsterDeveloper
Copy link
Contributor

Can you leave and example using inline keyboard button, callback query and edit message text?

@Thorapio
Copy link

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!

@eternnoir
Copy link
Owner Author

@Thorapio Try to update python-requests pip install -U requests.

@Thorapio
Copy link

@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!

@pevdh
Copy link
Collaborator

pevdh commented Apr 19, 2016

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.

@thakryptex
Copy link

There is a typo in the name of the method:
"bot.edit_message_replay_markup()"

Correct is:
"bot.edit_message_reply_markup()"

v. 2.0.1

@MonsterDeveloper
Copy link
Contributor

Is there any way so send multiple inline buttons with only one message? Like this: http://prntscr.com/awi4dg

@thakryptex
Copy link

@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"}']"

@MonsterDeveloper
Copy link
Contributor

@thakryptex Oh. Originally, I use that code: http://pastebin.com/AsN6qrum. I tried this: http://pastebin.com/6D4jaMz6 but no succes

@thakryptex
Copy link

@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.

@MonsterDeveloper
Copy link
Contributor

@thakryptex Well, I think there is no way to do that. Waiting for @eternnoir answer right now)

@eternnoir
Copy link
Owner Author

eternnoir commented Apr 26, 2016

@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

@MonsterDeveloper
Copy link
Contributor

@eternnoir Thank you! I will try it when I come home)

@MonsterDeveloper
Copy link
Contributor

@eternnoir Thanks! That worked for me!

@thakryptex
Copy link

@eternnoir oh, thanks, now I understand what was wrong.

@sravanthi-nyllabs
Copy link

@eternnoir
Appreciate your work man!
Regarding About Is there any way so send multiple inline buttons with only one message? Try this
How can I add reply_to to the InlinekeyboardButton?

@kingofnull
Copy link

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?

@itJunky
Copy link

itJunky commented Aug 31, 2018

How about sendGame method?
https://core.telegram.org/bots/api#sendgame

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants