1.1.0 • Published 2 years ago

@michpl/telegram-calendar v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

Telegram

Build Status

Simple and easy service to create a calendar in telegram

Demo days Demo years

Options

nametypedefaultdescription
weekDayNamesstring[]'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'Week days names
monthNamesstring[]'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'Months names
averageYearsnumber14Years count which used for creating years buttons (input year - averageYears, input year + averageYears)
callbackDataTypestring'calendar'Will be send as type
ignoreButtonValuestring or number0Value of the button for empty buttons
minDatestring or number or DatenullMin date
maxDatestring or number or DatenullMax date
startFromSundaybooleanfalseDoes the week start on Sunday. If set, then the first day is Sunday. Note: if true and weekDayNames are changed, then the order of days from weekDayNames will be used

Using sample

const {Calendar} = require('telegram-calendar');

const calendar = new Calendar();
telegramAdapter.send = {
  parse_mode: 'html',
  reply_markup: JSON.stringify({
    inline_keyboard: calendar.getPage(new Date())
  })
}

Additional Information

If for any reason you want to change the contents of a buttons, you can inherit and override the createCallbackButton function. It implements as protected

const {Calendar} = require('telegram-calendar');

module.exports = class NewCalendar extends Calendar {
    createCallbackButton(name, value, action = null) {
        return {
            name,
            type: 'new type',
            date,
            action
        };
    }
};
1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

4 years ago

1.0.0

6 years ago