Giter VIP home page Giter VIP logo

telegram-inline-calendar's Issues

Get the wrong time when calling clickButtonCalendar

When I call
result = session.calendar.clickButtonCalendar(callbackQuery) to get the time from callbackQuery I receive the wrong time when selecting it from the range 00:00-00:59. For example, I choose 00:15 and result = 'YYYY-MM-DD 12:15' but definitely must be 'YYYY-MM-DD 00:15'. Am I doing something wrong?

TypeError: NavCalendar is not a constructor

Hello, all options give errors. How to solve the problem?

const NavCalendar = require('telegram-inline-calendar')

ReferenceError: require is not defined in ES module scope, you can use import instead

import { NavCalendar } from 'telegram-inline-calendar'

SyntaxError: Named export 'NavCalendar' not found. The requested module 'telegram-inline-calendar' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:
import pkg from 'telegram-inline-calendar';
const { NavCalendar } = pkg;

import pkg from 'telegram-inline-calendar'
const { NavCalendar } = pkg
console.log(pkg)
const calendar = new NavCalendar(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"
});

[class Calendar]
TypeError: NavCalendar is not a constructor

import * as pkg from 'telegram-inline-calendar'
const { NavCalendar } = pkg
console.log(pkg)

[Module: null prototype] { default: [class Calendar] }
TypeError: NavCalendar is not a constructor

'Bad Request' Error

Hi there! Got this error while entering /start command

Unhandled rejection Error: TELEGRAM: 400 Bad Request: BUTTON DATA_INVALID

Could you please provide some info - is the cause of this issue and how it can be solved?
Thank you

I can't switch months 😞

First i want to thank you for your fantastic calendar 🎉

I do have a problem, I just think I don't know how to do it correctly.
I can see the callendar on the chat, but I can change month or year just once and than it stops.

I have the following Wizard scene:

const reminderWizard = (userId) => {
	return new WizardScene(
		"my-wizard",
		async (ctx) => {
			await ctx.reply(`What's your name?`);
			ctx.wizard.cursor = 0;
			return ctx.wizard.next();
		},
		async (ctx) => {
			const resp = ctx.message.text;
			ctx.scene.session.state.subject = resp;

			await ctx.reply(`What's your job?`);
			return ctx.wizard.next();
		},
		async (ctx) => {
			const resp = ctx.message.text;
			ctx.scene.session.state.description = resp;
			console.log("Received response: ", resp);


			// show calendar!!!
			calendar.startNavCalendar(ctx.message);

			return ctx.wizard.next();
		},
		async (ctx) => {
			const resp = ctx.message.text;
			console.log("Received response: ", resp);
			
			// Hmmm how does this work???
			if (
				ctx.callbackQuery.message.message_id ==
				calendar.chats.get(ctx.callbackQuery.message.chat.id)
			) {
				res = calendar.clickButtonCalendar(ctx.callbackQuery);
				if (res !== -1) {
					await ctx.reply("You selected: " + res);
				}
			} else {
				await ctx.reply(`Thank you for your payment!`);
			}
			
			return ctx.wizard.next();
		},
		async (ctx) => {
			const resp = ctx.message;

			console.log("Received response: ", resp);

			await ctx.reply("I registered your subscription");

			return await ctx.scene.leave();
		}
	);
};

My assumption is that this snippet is not enough:

if (
				ctx.callbackQuery.message.message_id ==
				calendar.chats.get(ctx.callbackQuery.message.chat.id)
			) {
				res = calendar.clickButtonCalendar(ctx.callbackQuery);
				if (res !== -1) {
					await ctx.reply("You selected: " + res);
				}
			}

Can you please help me with a solution?

Change message

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

Changing days order

Hi again! Could you please help me - how could i change this piece of code so that the days order starts from Monday?

Screenshot 2023-01-11 at 17 33 01

Error when trying to move through months

So when I press the advance button to go to the next month nothing happens. it loads for a bit but neither the month nor the days change. And when i press it again, the bot simply crashes. Here is the error log:

image.

Also when I press the go back button it changes to january and skips february. And the it gets stuck on january and it cant advance back to march.

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.