TelegramService

TelegramService

Source:

Manages telegram service two way communication

Members

(private, static) api

Source:
Properties:
Name Type Description
api Telegram

Link to Telegram Module

(private, static) initialized

Source:
Properties:
Name Type Description
initialized Boolean

If initialized

Methods

(static) get_hook_id() → {Number}

Source:

Get Bot chat ID

Returns:
Type
Number

(static) init(tcid) → {Promise}

Source:

Initialize Telegram Manager

Parameters:
Name Type Description
tcid Number

Chat ID (if provided)

Returns:
Type
Promise

(static) is_hooked() → {Boolean}

Source:

Check if Chat ID has been linked

Returns:
Type
Boolean

(private, static) manage_message(message, matches, hook)

Source:

Check if call is authorized

Parameters:
Name Type Description
message Object

Message received from the Bot

matches Array.<String>

Regex captured matches

hook Object

Managed hook

(static) register_message_hook(hook) → {Promise}

Source:

Check if call is authorized

Parameters:
Name Type Description
hook Object

Hook to be registered on Telegram Bot

Returns:
Type
Promise

(static) respond(message, content, plain) → {Promise}

Source:

Respond to a user's message

Parameters:
Name Type Description
message Object

Message you want answer to

content String

Answer's content

plain Boolean

Disable markdown/html parse mode

Returns:
Type
Promise

(static) send(content, reply, accepted_responses, one_time_keyboard, plain) → {Promise}

Source:

Send a message to user

Parameters:
Name Type Description
content String

Message's content

reply Boolean | Array

Force a user reply using normal or customized keyboard

accepted_responses Array

Validates user response

one_time_keyboard Boolean

Close custom keyboard after use

plain Boolean

Disable markdown/html parse mode

Returns:
Type
Promise

(static) set_hook_id(id) → {Number}

Source:

Set Bot chat ID

Parameters:
Name Type Description
id Number

Chat ID to be set

Returns:
Type
Number