Constructor
new Extra(optsopt)
Name | Type | Attributes | Description |
---|---|---|---|
opts | object | <optional> | Initial extra parameters
|
Members
(static) Markup :Markup
Markup class. You can import Markup from Extra
const { Extra: { Markup } } = require('opengram')
- Markup
Methods
HTML(valueopt) → {Extra}
Enable / Disable parse_mode: 'HTML'
for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
caption(captionopt) → {Extra}
Adds caption for the animation, audio, document, photo, video or voice
Name | Type | Attributes | Description |
---|---|---|---|
caption | string | <optional> | The text of caption |
- Type:
- Extra
captionEntities(entities) → {Extra}
Adds caption entities for the animation, audio, document, photo, video or voice
Name | Type | Description |
---|---|---|
entities | Array.<MessageEntity> | Array of entities |
- Type:
- Extra
entities(entities) → {Extra}
Adds entities for message text
Name | Type | Description |
---|---|---|
entities | Array.<MessageEntity> | Array of entities |
- Type:
- Extra
inReplyTo(messageId) → {Extra}
Adding reply to message
Name | Type | Description |
---|---|---|
messageId | number | Message id to reply |
- Type:
- Extra
load(opts) → {Extra}
Loads extra parameters from object to Extra instance
// Returns new instance with `reply_to_message_id: 1`
Extra.load({ reply_to_message_id: 1 })
// Loads `reply_to_message_id: 1` parameter to exists instance
new Extra().load({ reply_to_message_id: 1 })
Name | Type | Description |
---|---|---|
opts | object | Extra parameters object |
- Type:
- Extra
markdown(valueopt) → {Extra}
Enable / Disable parse_mode: 'Markdown'
for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
markdownV2(valueopt) → {Extra}
Enable / Disable parse_mode: 'MarkdownV2'
for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | value |
- Type:
- Extra
markup(markup) → {Extra}
Adds (inline-)keyboard markup to Extra instance
// Example with factory function
ctx.reply('Hello',
Extra.markdown()
.markup((markup) => markup.removeKeyboard())
)
// With Markup instance / object
const { Markup } = require('opengram')
const keyboard = Markup.inlineKeyboard([Markup.callbackButton('Anime', 'data')])
ctx.reply('Hello',
Extra.markdown().markup(keyboard)
)
Name | Type | Description |
---|---|---|
markup | object | | Callback returning markup / Markup object |
- Type:
- Extra
notifications(valueopt) → {Extra}
Enable / Disable notification for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
webPreview(valueopt) → {Extra}
Enable / Disable web preview for links in message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
(static) HTML(valueopt) → {Extra}
Enable / Disable parse_mode: 'HTML'
for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
(static) caption(captionopt) → {Extra}
Adds caption for the animation, audio, document, photo, video or voice
Name | Type | Attributes | Description |
---|---|---|---|
caption | string | <optional> | The text of caption |
- Type:
- Extra
(static) captionEntities(entities) → {Extra}
Adds caption entities for the animation, audio, document, photo, video or voice
Name | Type | Description |
---|---|---|
entities | Array.<MessageEntity> | Array of entities |
- Type:
- Extra
(static) entities(entities) → {Extra}
Adds entities for message text
Name | Type | Description |
---|---|---|
entities | Array.<MessageEntity> | Array of entities |
- Type:
- Extra
(static) inReplyTo(messageId) → {Extra}
Adding reply to message
Name | Type | Description |
---|---|---|
messageId | number | Message id to reply |
- Type:
- Extra
(static) load(opts) → {Extra}
Loads extra parameters from object to Extra instance
// Returns new instance with `reply_to_message_id: 1`
Extra.load({ reply_to_message_id: 1 })
// Loads `reply_to_message_id: 1` parameter to exists instance
new Extra().load({ reply_to_message_id: 1 })
Name | Type | Description |
---|---|---|
opts | object | Extra parameters object |
- Type:
- Extra
(static) markdown(valueopt) → {Extra}
Enable / Disable parse_mode: 'Markdown'
for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
(static) markdownV2(valueopt) → {Extra}
Enable / Disable parse_mode: 'MarkdownV2'
for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
(static) markup(markup) → {object}
Adds (inline-)keyboard markup to Extra instance
// Example with factory function
ctx.reply('Hello',
Extra.markdown()
.markup((markup) => markup.removeKeyboard())
)
// With Markup instance / object
const { Markup } = require('opengram')
const keyboard = Markup.inlineKeyboard([Markup.callbackButton('Anime', 'data')])
ctx.reply('Hello',
Extra.markdown().markup(keyboard)
)
Name | Type | Description |
---|---|---|
markup | object | | Markup object |
- Type:
- object
(static) notifications(valueopt) → {Extra}
Enable / Disable notification for message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra
(static) webPreview(valueopt) → {Extra}
Enable / Disable web preview for links in message
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
value | boolean | <optional> | true | Value |
- Type:
- Extra