I'm using banChatMember like this bot.banChatMember(chatId, parseInt(m, 10), ban) but it gives me some weird error like TypeError: Cannot create property 'chat_id' on number '1689496709' where it's mixing up the ban date and the chatId.
Looking at the function definition on main package:
* @param {Number|String} chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
* @param {Number} userId Unique identifier of the target user
* @param {Object} [options] Additional Telegram query options
* @return {Promise} True on success.
* @see https://core.telegram.org/bots/api#banchatmember
*/
banChatMember(chatId, userId, form = {}) {
form.chat_id = chatId;
form.user_id = userId;
return this._request('banChatMember', { form });
}
The correct is: banChatMember(chatId, userId)
or if you need to pass the optional params:
banChatMember(chatId, userId, { untilDate: XXXXX, revoke_messages: YYYY })
packages:
"node-telegram-bot-api": "^0.61.0", "@types/node-telegram-bot-api": "^0.61.6",
I'm using
banChatMember
like thisbot.banChatMember(chatId, parseInt(m, 10), ban)
but it gives me some weird error likeTypeError: Cannot create property 'chat_id' on number '1689496709'
where it's mixing up the ban date and the chatId.Looking at the function definition on main package:
but on typescript, gives me this signature:
which one is not correct? If I remove the
ban
timer and just call with 2 arguments it works fine