| Did you know ... | Search Documentation: |
| Pack telegrambot -- prolog/telegrambot.pl |
Predicates to use the Telegram Bot API.
The following example sends a "Message Received" text in response to the /start command from any client:
:- use_module(library(telegrambot)).
use_token('the bot Token from the BotFather here').
get_chat_id(json(Lst), Id) :-
member(message=json(A), Lst),
member(chat=json(B), A),
member(id=Id, B).
start_handler(Message, Params) :-
write('start received'),
write(Message),
get_chat_id(Message, ChatId),
send_message(ChatId, 'Message Received', [], _).
command_handler(start, start_handler).
main_pred :-
bot_loop.
:- initialization(main_pred, main).
Example:
send_message(12345, 'Hello *world*', [parse_mode='Markdown'], Return).
The following predicates are exported, but not or incorrectly documented.