Git Product home page Git Product logo

telegram-calendar's Introduction

Telegram

Build Status

Simple and easy service to create a calendar in telegram

Demo days Demo years

Options

name type default description
weekDayNames string[] ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'] Week days names
monthNames string[] ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] Months names
averageYears number 14 Years count which used for creating years buttons ([input year - averageYears, input year + averageYears])
callbackDataType string 'calendar' Will be send as type
ignoreButtonValue string or number 0 Value of the button for empty buttons
minDate string or number or Date null Min date
maxDate string or number or Date null Max date
startFromSunday boolean false Does 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
        };
    }
};

telegram-calendar's People

Contributors

dependabot[bot] avatar michpl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

telegram-calendar's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.