Comments (4)
Reply markup
You just need to send json string as reply_markup
const char *reply_markup = "{\"keyboard\":[[\"Yes\",\"No\"],[\"Maybe\"],[\"0\",\"1\",\"3\"]],\"one_time_keyboard\":True}"
ret = telebot_send_message(handle, chat_id, "Does it work", "HTML", false, false, message_id, reply_markup);
Inline keyboard
Here is JSON example of keyboards
3-row example
[[{"text":"text 1","callback_data":"1"},{"text":"Some button text 2","url":"https://elmurod.net"},{"text":"Some button text 3","callback_data":"3"}]]
2-row, 2+1 columns
[[{"text":"Text 1","callback_data":"1"},{"text":"Link 1","url":"https://elmurod.net"}],[{"text":"Text2","callback_data":"2"}]]
from telebot.
I have try to send by first method simple json and it's fail:
[DEBUG][telebot_core_curl_perform:142]Response: {"ok":true,"result":[{"update_id":760823970, "message":{"message_id":56,"from":{"id":115948583,"is_bot":false,"first_name":"\u0421\u0430\u043c\u0443\u0438\u043b \u0413\u0435\u0440\u043c\u0430\u043d\u043e\u0432\u0438\u0447","last_name":"\u0410\u0440\u043a\u0430\u043d\u0443\u043c","username":"Arcanum7","language_code":"ru"},"chat":{"id":115948583,"first_name":"\u0421\u0430\u043c\u0443\u0438\u043b \u0413\u0435\u0440\u043c\u0430\u043d\u043e\u0432\u0438\u0447","last_name":"\u0410\u0440\u043a\u0430\u043d\u0443\u043c","username":"Arcanum7","type":"private"},"date":1603264033,"text":"/start","entities":[{"offset":0,"length":6,"type":"bot_command"}]}}]} Number of updates: 1 Самуил Германович: /start [ERROR][telebot_core_curl_perform:137]Wrong HTTP response received, response: 400
i had use this code:
if (strstr(message.text, "/start"))
{
const char* reply_markup = "{\"keyboard\":[[\"Yes\",\"No\"],[\"Maybe\"],[\"0\",\"1\",\"3\"]],\"one_time_keyboard\":True}";
ret_proc = telebot_send_message(handle, message.chat->id, "Does it work", "HTML", false, false, updates[index].message.message_id, reply_markup);
}
upd: how to use telebot_reply_keyboard_markup stuct?
from telebot.
and it work:
const char* reply_markup = " { \"keyboard\": [[{\"text\": \"1\"}],[{ \"text\": \"2\"},{ \"text\": \"3\"}]] } ";
last Q? for this issue - how to use telebot_reply_keyboard_markup ?
write pure json in c - it is very interesting existential experience, yep...
from telebot.
I don't have time to work on this project. I believe it would be better keyboards as data structure...
from telebot.
Related Issues (20)
- stdbool.h header is not added by default HOT 2
- Can we add static library to CMakeList.txt file? HOT 2
- User editing already send message will result in crash. HOT 3
- Possible deadlock in telebot-core.telebot_core_curl_perform() HOT 3
- echobot leaks memory HOT 1
- Telebot crashes if user send less then 3 characters. HOT 2
- No releases yet HOT 1
- Bot crashes when two identic messages were sent in a row HOT 1
- Does not compile statically HOT 6
- docs? HOT 8
- Telebot does not provide API result to user HOT 5
- run makefile console error in Centos 7.8 HOT 3
- can't get caption HOT 1
- make install would be nice HOT 4
- disable_notification is not working ? HOT 1
- too frequent fatal errors HOT 8
- Error on file send HOT 1
- Crash on messages forwarded from chats
- free(): invalid pointer - in telebot_put_user HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telebot.