yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.3k stars 1.5k forks source link

getMyCommands not working properly #1014

Closed cleivson closed 1 year ago

cleivson commented 1 year ago

Bug Report

I have read:

I am using the latest version of the library.

Expected Behavior

When calling getMyCommands with the parameters defined on the Typescript version with different scopes, the different command sets associated with the scopes should be returned.

Actual Behavior

Right now it looks like the type definition and the actual signature don't match and it completely ignores both the locale and scope parameters of the GetMyCommands because it considers the first parameter to be the "form" field of the request but it's actually the scope object. Basically, the correct interface of the method should be (form: { scope: BotScope, language_code: string }) rather than (scope: BotScope, language_code: string) as mentioned in the typescript definition. Also, the scope parameter must be stringified but it's currently not.

Steps to reproduce the Behavior

cleivson commented 1 year ago

The setMyCommands api also has type problems. Here is an example: image

danielperez9430 commented 1 year ago

For getMyCommands you also miss the "scope" field in your object @cleivson

bot.getMyCommands({ scope: { type: "all_private_chats" } })

In the next release with the Telegram Bot API 6.4 the issure also with the stringify is solve

danielperez9430 commented 1 year ago

Fixed on v0.61.0