viva-telegram
v1.0.41
Published
helpers for telegram bot
Downloads
7
Readme
Classes
Typedefs
Telegram
(license MIT) library for work with telegram, full example - see example.js
Kind: global class
- Telegram
- .bot_name : string
- .cache : lib_cache
- .message_text_markdown_escape(text) ⇒ string
- .launch(token, [option], callback)
- .keyboard(notice, message, keyboard, [option], [callback])
- .message(notice, message, [buttons], [option], [callback])
- .image(notice, image, [message], [buttons], [option], [callback])
- .delete(notice, message_id, [callback])
- .load_from_cashe(account, message_id, callback)
- .queue(notice, items, [callback])
telegram.bot_name : string
Kind: instance property of Telegram
telegram.cache : lib_cache
Kind: instance property of Telegram
telegram.message_text_markdown_escape(text) ⇒ string
escaping service markdown characters
Kind: instance method of Telegram
| Param | Type | | --- | --- | | text | string |
telegram.launch(token, [option], callback)
main function for launch bot
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | token | string | | | [option] | type_option | | | callback | function | error |
telegram.keyboard(notice, message, keyboard, [option], [callback])
send message and create keyboard, located under the text entry field
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | notice | type_notice | | | message | string | | | keyboard | Array.<Array.<type_send_keyboardmenu_option>> | | | [option] | type_send_keyboard_option | | | [callback] | function | message_id - number |
telegram.message(notice, message, [buttons], [option], [callback])
send message with buttons below this message
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | notice | type_notice | | | message | string | | | [buttons] | Array.<Array.<type_send_button>> | | | [option] | type_send_message_option | | | [callback] | function | message_id - number |
telegram.image(notice, image, [message], [buttons], [option], [callback])
send image with buttons below this message
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | notice | type_notice | | | image | Buffer | | | [message] | string | | | [buttons] | Array.<Array.<type_send_button>> | | | [option] | type_send_image_option | | | [callback] | function | message_id - number |
telegram.delete(notice, message_id, [callback])
delete previously sent message or image
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | notice | type_notice | | | message_id | number | | | [callback] | function | is_deleted - boolean |
telegram.load_from_cashe(account, message_id, callback)
from cashe load previously saved message or image
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | account | string | | | message_id | number | | | callback | function | (error, result = {message, buttons, option, image}) |
telegram.queue(notice, items, [callback])
send many messages
Kind: instance method of Telegram
| Param | Type | Description | | --- | --- | --- | | notice | type_notice | | | items | Array.<type_send_queue_message> | | | [callback] | function | message_ids - number[] |
type_option
Kind: global typedef
Properties
| Name | Type | Description | | --- | --- | --- | | [cashe_callback_data] | string | cashed callback data subsystem: default mode work (can be specified explicitly in each message), variants - 'manual', 'all', 'auto', default - 'manual' | | [cashe_callback_data_path] | string | cashed callback data subsystem: path for save cache | | [cashe_callback_data_path_bot_name] | boolean | cashed callback data subsystem: add to option "cashe_callback_data_path" bot name, default - true | | [cashe_callback_data_timelive] | number | cashed callback data subsystem: timelive for cashed data live, in minutes | | [cashe_message] | boolean | cashed message subsystem: default mode work (can be specified explicitly in each message) - default - false | | [cashe_message_path] | string | cashed message subsystem: path for save cache | | [cashe_message_path_bot_name] | boolean | cashed message subsystem: add to option "cashe_message_path" bot name, default - true | | [cashe_message_timelive] | number | cashed message subsystem: timelive for cashed data live, in minutes |
type_send_keyboardmenu_option
Kind: global typedef
Properties
| Name | Type | | --- | --- | | text | string | | [is_request_contact] | boolean | | [is_request_location] | boolean |
type_send_message_option
Kind: global typedef
Properties
| Name | Type | | --- | --- | | [is_message_format_markdown] | boolean | | [is_keyboard_remove] | boolean | | [is_reply_to_message_from_notice] | boolean | | [cashe_message] | boolean |
type_send_image_option
Kind: global typedef
Properties
| Name | Type | | --- | --- | | [is_message_format_markdown] | boolean | | [is_keyboard_remove] | boolean | | [is_reply_to_message_from_notice] | boolean | | [cashe_message] | boolean |
type_send_button
Kind: global typedef
Properties
| Name | Type | | --- | --- | | text | string | | [callback_data] | string | Object | | [cashe_callback_data] | boolean |
type_send_queue_message
Kind: global typedef
Properties
| Name | Type | | --- | --- | | message | string | | [buttons] | Array.<Array.<type_send_button>> | | [option] | type_send_message_option |