- Example 1. Calendar
- Example 2. Calendar + Time Selector
- Example 3. Time Selector
- Example 4. Date blocking
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import TelegramBot from 'node-telegram-bot-api';
import {Calendar} from 'telegram-inline-calendar';
process.env.NTBA_FIX_319 = 1;
const bot = new TelegramBot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'DD-MM-YYYY',
language: 'en'
});
bot.onText(/\/start/, (msg) => calendar.startNavCalendar(msg));
bot.on("callback_query", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import {Telegraf} from 'telegraf';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telegraf(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'DD-MM-YYYY',
language: 'en',
bot_api: 'telegraf'
});
bot.start((ctx) => calendar.startNavCalendar(ctx));
bot.on("callback_query", (ctx) => {
if (ctx.callbackQuery.message.message_id == calendar.chats.get(ctx.callbackQuery.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.launch();
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import Telebot from 'telebot';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telebot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'DD-MM-YYYY',
language: 'en',
bot_api: 'telebot'
});
bot.on('/start', (msg) => calendar.startNavCalendar(msg));
bot.on("callbackQuery", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
bot.connect();
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import { Bot } from 'grammy';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Bot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'DD-MM-YYYY',
language: 'en',
bot_api: 'grammy'
});
bot.command('start', ctx => calendar.startNavCalendar(ctx))
bot.on("callback_query:data", (ctx) => {
if (ctx.msg.message_id == calendar.chats.get(ctx.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.start();
![](https://github.com/VDS13/telegram-inline-calendar/raw/main/img/demo.gif)
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import TelegramBot from 'node-telegram-bot-api';
import {Calendar} from 'telegram-inline-calendar';
process.env.NTBA_FIX_319 = 1;
const bot = new TelegramBot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m"
});
bot.onText(/\/start/, (msg) => calendar.startNavCalendar(msg));
bot.on("callback_query", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import {Telegraf} from 'telegraf';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telegraf(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
bot_api: "telegraf",
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m"
});
bot.start((ctx) => calendar.startNavCalendar(ctx));
bot.on("callback_query", (ctx) => {
if (ctx.callbackQuery.message.message_id == calendar.chats.get(ctx.callbackQuery.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.launch();
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import Telebot from 'telebot';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telebot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
bot_api: "telebot",
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m"
});
bot.on('/start', (msg) => calendar.startNavCalendar(msg));
bot.on("callbackQuery", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
bot.connect();
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import { Bot } from 'grammy';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Bot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
bot_api: "grammy",
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m"
});
bot.command('start', ctx => calendar.startNavCalendar(ctx))
bot.on("callback_query:data", (ctx) => {
if (ctx.msg.message_id == calendar.chats.get(ctx.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.start();
![](https://github.com/VDS13/telegram-inline-calendar/raw/main/img/demo2.gif)
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import TelegramBot from 'node-telegram-bot-api';
import {Calendar} from 'telegram-inline-calendar';
process.env.NTBA_FIX_319 = 1;
const bot = new TelegramBot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'HH:mm',
language: 'fr',
time_range: "05:00-08:59",
time_step: "10m"
});
bot.onText(/\/start/, (msg) => calendar.startTimeSelector(msg));
bot.on("callback_query", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import {Telegraf} from 'telegraf';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telegraf(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'HH:mm',
language: 'fr',
bot_api: "telegraf",
time_range: "05:00-08:59",
time_step: "10m"
});
bot.start((ctx) => calendar.startTimeSelector(ctx));
bot.on("callback_query", (ctx) => {
if (ctx.callbackQuery.message.message_id == calendar.chats.get(ctx.callbackQuery.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.launch();
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import Telebot from 'telebot';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telebot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'HH:mm',
language: 'fr',
bot_api: "telebot",
time_range: "05:00-08:59",
time_step: "10m"
});
bot.on('/start', (msg) => calendar.startNavCalendar(msg));
bot.on("callbackQuery", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
bot.connect();
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import { Bot } from 'grammy';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Bot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'HH:mm',
language: 'fr',
bot_api: "grammy",
time_range: "05:00-08:59",
time_step: "10m"
});
bot.command('start', ctx => calendar.startTimeSelector(ctx))
bot.on("callback_query:data", (ctx) => {
if (ctx.msg.message_id == calendar.chats.get(ctx.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.start();
![](https://github.com/VDS13/telegram-inline-calendar/raw/main/img/demo3.gif)
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import TelegramBot from 'node-telegram-bot-api';
import {Calendar} from 'telegram-inline-calendar';
process.env.NTBA_FIX_319 = 1;
const bot = new TelegramBot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m",
lock_date: true
});
calendar.lock_date_array = ["2023-11-17", "2023-11-19"];
bot.onText(/\/start/, (msg) => calendar.startNavCalendar(msg));
bot.on("callback_query", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import {Telegraf} from 'telegraf';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telegraf(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
bot_api: "telegraf",
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m",
lock_date: true
});
calendar.lock_date_array = ["2023-11-17", "2023-11-19"];
bot.start((ctx) => calendar.startNavCalendar(ctx));
bot.on("callback_query", (ctx) => {
if (ctx.callbackQuery.message.message_id == calendar.chats.get(ctx.callbackQuery.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.launch();
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import Telebot from 'telebot';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Telebot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
bot_api: "telebot",
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m",
lock_date: true
});
calendar.lock_date_array = ["2023-11-17", "2023-11-19"];
bot.on('/start', (msg) => calendar.startNavCalendar(msg));
bot.on("callbackQuery", (query) => {
if (query.message.message_id == calendar.chats.get(query.message.chat.id)) {
var res;
res = calendar.clickButtonCalendar(query);
if (res !== -1) {
bot.sendMessage(query.message.chat.id, "You selected: " + res);
}
}
});
bot.connect();
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
import { Bot } from 'grammy';
import {Calendar} from 'telegram-inline-calendar';
const bot = new Bot(TOKEN, {polling: true});
const calendar = new Calendar(bot, {
date_format: 'MMM D, YYYY h:mm A',
language: 'de',
start_week_day: 1,
bot_api: "grammy",
time_selector_mod: true,
time_range: "08:00-15:59",
time_step: "15m",
lock_date: true
});
calendar.lock_date_array = ["2023-11-17", "2023-11-19"];
bot.command('start', ctx => calendar.startNavCalendar(ctx))
bot.on("callback_query:data", (ctx) => {
if (ctx.msg.message_id == calendar.chats.get(ctx.chat.id)) {
var res;
res = calendar.clickButtonCalendar(ctx);
if (res !== -1) {
ctx.reply("You selected: " + res);
}
}
});
bot.start();