From 8b377612c842b75d8409c10fbaada719e7d693cc Mon Sep 17 00:00:00 2001 From: pimhwang Date: Sun, 14 Jan 2024 11:01:22 +0800 Subject: [PATCH] change sendMessage to sendTextMessage --- src/message.ts | 15 ++++++++------- src/types/index.ts | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/message.ts b/src/message.ts index c108182..558aa99 100644 --- a/src/message.ts +++ b/src/message.ts @@ -66,13 +66,14 @@ export class PotatoMessageEncoder extends MessageEncoder { // send previous asset if there is any await this.sendAsset() } else if (this.payload.caption) { - const result = await this.bot.internal.sendMessage({ - chat_id: this.payload.chat_id, - text: this.payload.caption, - parse_mode: this.payload.parse_mode, - reply_to_message_id: this.payload.reply_to_message_id, - message_thread_id: this.payload.message_thread_id, - disable_web_page_preview: !this.options.linkPreview, + const result = await this.bot.internal.sendTextMessage({ + chat_type: 1, + chat_id: parseInt(this.payload.chat_id), + text: this.payload.caption + // parse_mode: this.payload.parse_mode, + // reply_to_message_id: this.payload.reply_to_message_id, + // message_thread_id: this.payload.message_thread_id, + // disable_web_page_preview: !this.options.linkPreview, }) await this.addResult(result) delete this.payload.reply_to_message_id diff --git a/src/types/index.ts b/src/types/index.ts index 1542c7c..ccc3b41 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1549,6 +1549,7 @@ export interface InputMediaDocument { export type InputFile = any export interface SendMessagePayload { + chat_type: Integer /** Unique identifier for the target chat or username of the target channel (in the format @channelusername) */ chat_id?: Integer | string /** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */ @@ -2522,7 +2523,7 @@ declare module './internal' { * Use this method to send text messages. On success, the sent Message is returned. * @see https://potato.im/api#sendmessage */ - sendMessage(payload: SendMessagePayload): Promise + sendTextMessage(payload: SendMessagePayload): Promise /** * Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned. * @see https://potato.im/api#forwardmessage @@ -2915,7 +2916,7 @@ declare module './internal' { Internal.define('getMe') Internal.define('logOut') Internal.define('close') -Internal.define('sendMessage') +Internal.define('sendTextMessage') Internal.define('forwardMessage') Internal.define('copyMessage') Internal.define('sendPhoto')