Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
telegram-inline-calendar
Advanced tools
Date and time picker and inline calendar for Node.js telegram bots
Using this simple inline calendar you can allow your Telegram bot to ask dates.
Supported languages:
Supported Telegram bot libraries:
There are two versions:
npm i telegram-inline-calendar
npm i telegram-inline-calendar@ecmascript
✍️ Note: If you use Typescript you can install this package that contains type definitions for this library
npm install --save-dev telegram-inline-calendar-types
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
const TelegramBot = require('node-telegram-bot-api');
const Calendar = require('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)) {
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 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';
const {Telegraf} = require('telegraf');
const Calendar = require('telegram-inline-calendar');
const bot = new Telegraf(TOKEN);
const calendar = new Calendar(bot, {
date_format: 'DD-MM-YYYY',
language: 'en',
bot_api: 'telegraf'
});
bot.start((ctx) => calendar.startNavCalendar(ctx.message));
bot.on("callback_query", (ctx) => {
if (ctx.callbackQuery.message.message_id == calendar.chats.get(ctx.callbackQuery.message.chat.id)) {
res = calendar.clickButtonCalendar(ctx.callbackQuery);
if (res !== -1) {
bot.telegram.sendMessage(ctx.callbackQuery.message.chat.id, "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 {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';
const Telebot = require('telebot');
const Calendar = require('telegram-inline-calendar');
const bot = new Telebot(TOKEN);
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)) {
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 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';
const { Bot } = require('grammy');
const Calendar = require('telegram-inline-calendar');
const bot = new Bot(TOKEN);
const calendar = new Calendar(bot, {
date_format: 'DD-MM-YYYY',
language: 'en',
bot_api: 'grammy'
});
bot.command('start', ctx => calendar.startNavCalendar(ctx.msg))
bot.on("callback_query:data", async (ctx) => {
if (ctx.msg.message_id === calendar.chats.get(ctx.chat.id)) {
res = calendar.clickButtonCalendar(ctx.callbackQuery);
if (res !== -1) {
await ctx.reply("You selected: " + res);
}
}
});
bot.start();
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();
{
date_format: 'YYYY-MM-DD', //Datetime result format
language: 'en', //Language (en/es/de/es/fr/it/tr/id/uk)
bot_api: 'node-telegram-bot-api', //Telegram bot library
close_calendar: true, //Close calendar after date selection
start_week_day: 0, //First day of the week(Sunday - `0`, Monday - `1`, Tuesday - `2` and so on)
time_selector_mod: false, //Enable time selection after a date is selected.
time_range: "00:00-23:59", //Allowed time range in "HH:mm-HH:mm" format
time_step: "30m", //Time step in the format "<Time step><m | h>"
start_date: false, //Minimum date of the calendar in the format "YYYY-MM-DD" or "YYYY-MM-DD HH:mm" or "now"
stop_date: false, //Maximum date of the calendar in the format "YYYY-MM-DD" or "YYYY-MM-DD HH:mm" or "now"
custom_start_msg: false, //Text of the message sent with the calendar/time selector
lock_date: false, //Enable blocked dates list
lock_datetime: false //Enable list of blocked dates and times
}
The MIT License (MIT)
Copyright © 2022-2024 Dmitry Vyazin
FAQs
Date and time picker and inline calendar for Node.js telegram bots
The npm package telegram-inline-calendar receives a total of 148 weekly downloads. As such, telegram-inline-calendar popularity was classified as not popular.
We found that telegram-inline-calendar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.