API Reference
Calendar
Kind: global class
- Calendar
- new Calendar(bot, [options])
- instance
- .startNavCalendar(msg)
- .startTimeSelector(msg)
- .clickButtonCalendar(query) ⇒
String | Number
- .createNavigationKeyboard(date) ⇒
Object
- .createTimeSelector(date, from_calendar) ⇒
Object
- .changeLang(language)
Param | Type | Default | Description |
---|---|---|---|
bot | Boolean|TelegramBot |
false |
TelegramBot class instance (Telebot/node-telegram-bot-api) or false (Telegraf/grammY) |
[options] | Object |
||
[options.language] | String |
"en" |
Calendar language. |
[options.date_format] | String |
"YYYY-MM-DD" |
Date output format. |
[options.bot_api] | String |
"node-telegram-bot-api" |
Telegram bot library. |
[options.close_calendar] | Boolean |
true |
Close calendar after date selection. |
[options.start_week_day] | Number |
0 |
First day of the week (Sunday - 0 , Monday - 1 , Tuesday - 2 and so on). |
[options.time_selector_mod] | Boolean |
false |
Enable time selection after a date is selected. |
[options.time_range] | String |
"00:00-23:59" |
Allowed time range in "HH:mm-HH:mm" format. |
[options.time_step] | String |
"30m" |
Time step in the format "<Time step><m | h>", where "m" - minutes, "h" - hours. (For example: "30m" , "1h" , "150m" ). |
[options.start_date] | Boolean|String |
false |
Minimum date of the calendar in the format "YYYY-MM-DD". |
[options.stop_date] | Boolean|String |
false |
Maximum date of the calendar in the format "YYYY-MM-DD". |
[options.custom_start_msg] | Boolean|String |
false |
Text of the message sent with the calendar/time selector. |
[options.lock_date] | Boolean |
false |
Enable blocked dates list. |
[options.lock_datetime] | Boolean |
false |
Enable list of blocked dates and times. |
[lock_date_array] | Array |
[] |
Аrray of blocked dates in string format in the format "YYYY-MM-DD" . |
[lock_datetime_array] | Array |
[] |
Аrray of blocked dates and times in string format in the format "YYYY-MM-DD HH:mm" . |
Generating and sending a calendar to the user. Sets the current month and year.
Kind: instance method of Calendar
Param | Type | Description |
---|---|---|
msg | Object |
https://core.telegram.org/bots/api#message (Telebot/node-telegram-bot-api) https://deno.land/x/grammy@v1.15.1/mod.ts?s=Context (grammY) https://telegraf.js.org/classes/Context.html (Telegraf) |
Generating and sending a time selector to the user.
Kind: instance method of Calendar
Param | Type | Description |
---|---|---|
msg | Object |
https://core.telegram.org/bots/api#message (Telebot/node-telegram-bot-api) https://deno.land/x/grammy@v1.15.1/mod.ts?s=Context (grammY) https://telegraf.js.org/classes/Context.html (Telegraf) |
Handle clicking on the calendar or the time selector.
Kind: instance method of Calendar
Returns: String | Number
- If a date is selected, it will return a string in the specified format, otherwise it will return -1.
Param | Type | Description |
---|---|---|
query | Object |
https://core.telegram.org/bots/api#callbackquery (Telebot/node-telegram-bot-api) https://deno.land/x/grammy@v1.15.1/mod.ts?s=Context (grammY) https://telegraf.js.org/classes/Context.html (Telegraf) |
Calendar generation.
Kind: instance method of Calendar
Returns: Object
- InlineKeyboardMarkup (https://core.telegram.org/bots/api#inlinekeyboardmarkup)
Param | Type | Description |
---|---|---|
date | Date |
Year and month for which you want to get a calendar. |
Time selector generation.
Kind: instance method of Calendar
Returns: Object
- InlineKeyboardMarkup (https://core.telegram.org/bots/api#inlinekeyboardmarkup)
Param | Type | Default | Description |
---|---|---|---|
date | Date |
undefined |
Date Objects for which you want to get a time selector. |
from_calendar | Boolean |
false |
Calling the time selector from the calendar. |
Changes the language of the bot messages.
Kind: instance method of Calendar
Param | Type | Default | Description |
---|---|---|---|
language | String |
undefined |
Language (en/es/de/es/fr/it/tr/id/uk). |