Giter VIP home page Giter VIP logo

Comments (13)

AguChaves92 avatar AguChaves92 commented on July 28, 2024 1

thank you very much

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

Is there a way to change the message to other than please select a date?

Hello, Can you show an example of the result?

from telegram-inline-calendar.

AguChaves92 avatar AguChaves92 commented on July 28, 2024

Sure here:
image

when useing the command calenadr the message that displayes is please select a date. Is it possible to change it?

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024
const TOKEN = process.env.TELEGRAM_TOKEN || 'YOUR_TELEGRAM_BOT_TOKEN';
const {Telegraf} = require('telegraf');
const NavCalendar = require('telegram-inline-calendar')
const bot = new Telegraf(TOKEN);
const calendar = new NavCalendar(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, `Your custom message with date(${res})`);
        }
    }
});
bot.launch();
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

The clickButtonCalendar method itself returns the date in the format you choose, and can be further processed as you wish.
Examples:

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, `Your custom message with date(${res})`);
        }
    }
});
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) {
            console.log(`Your custom message with date(${res})`);
        }
    }
});

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

@AguChaves92,
I was able to help you?

from telegram-inline-calendar.

AguChaves92 avatar AguChaves92 commented on July 28, 2024

I don't mean the answer after picking the date, but before.
As I've understood it, the command tha launches the bot is this one right?:
bot.start((ctx) => calendar.startNavCalendar(ctx.message));

the triggers a response with a message and the calendar from the bot. I want to change that message.

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

I don't mean the answer after picking the date, but before. As I've understood it, the command tha launches the bot is this one right?: bot.start((ctx) => calendar.startNavCalendar(ctx.message));

the triggers a response with a message and the calendar from the bot. I want to change that message.

I'm sorry, I misunderstood you.
Tomorrow I will release an update with this functionality.

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

@AguChaves92 Released an update, please check.

from telegram-inline-calendar.

AguChaves92 avatar AguChaves92 commented on July 28, 2024

I see the custom message now thank you

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

@AguChaves92, Can the issue be closed?

from telegram-inline-calendar.

VDS13 avatar VDS13 commented on July 28, 2024

@AguChaves92 ?

from telegram-inline-calendar.

AguChaves92 avatar AguChaves92 commented on July 28, 2024

sry, yes

from telegram-inline-calendar.

Related Issues (11)

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.