Telegram
- Description:
Telegram Common Interface Implementation
- Source:
Methods
(async, static) answerCallback(ctx, response) → {Promise}
- Description:
Process answer callback
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
response |
object | Response object |
Returns:
- Type
- Promise
(static) commonizeContext(ctx, limit) → {Common.TelegramInteraction}
- Description:
Turns Telegram context to an object that can be used as an input to a common command handler
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | |
limit |
number | number of parsable args |
Returns:
limit
is tricky, it makes possible for argument to consist of multiple words
Example: /foo bar baz bax
- if we set limit here to 1, we will limit the number of args to 1 and this function will join all args with spaces, therefore args = ['bar baz bax'].
- if we set limit to 2, we will have 2 args as follows: args = ['bar', 'baz bax'], and so on.
- if we set limit to null, we will parse all words as standalone: args = ['bar', 'baz', 'bax'].
(static) getDefaultOther(ctx, overrides) → {object}
- Description:
Get default response settings
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
overrides |
object | Overrides object |
Returns:
other
object
- Type
- object
(async, static) getLegacyResponse(ctx, handler, definition) → {Array.<object>}
- Description:
Command handler interface that gets a response array acceptable by Telegram.Interaction
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
handler |
Common.CommandHandler | Handler function for command |
definition |
Common.CommandDefinition | Command definition |
Returns:
- Type
- Array.<object>
(async, static) handleCallback(ctx, handler)
- Description:
Callback handler interface
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
handler |
Common.CommandHandler | Handler function for callback |
(static) handleCommand(ctx, handler, definition)
- Description:
Command handler interface
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
handler |
Common.CommandHandler | Handler function for command |
definition |
Common.CommandDefinition | Command definition |
(async, static) reply(ctx, response, logger) → {Promise}
- Description:
Command reply interface
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
response |
object | Response object |
logger |
Returns:
- Type
- Promise
(async, static) replyWithText(ctx, response, logger) → {Promise}
- Description:
Reply to command with text message
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
Context | Telegram context |
response |
object | Response object |
logger |
Returns:
- Type
- Promise
(static) transformOverrides(response) → {object}
- Description:
Transform response object by converting overrides to platform specific parameters
- Source:
Parameters:
Name | Type | Description |
---|---|---|
response |
object | Response object |
Returns:
Updated response object
- Type
- object