Browse Source

change sendMessage to sendTextMessage

master
pimhwang 1 year ago
parent
commit
8b377612c8
  1. 15
      src/message.ts
  2. 5
      src/types/index.ts

15
src/message.ts

@ -66,13 +66,14 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> { @@ -66,13 +66,14 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
// 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

5
src/types/index.ts

@ -1549,6 +1549,7 @@ export interface InputMediaDocument { @@ -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' { @@ -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<Message>
sendTextMessage(payload: SendMessagePayload): Promise<Message>
/**
* 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' { @@ -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')

Loading…
Cancel
Save