|
|
|
@ -37,7 +37,7 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
@@ -37,7 +37,7 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
|
|
|
|
|
constructor(bot: PotatoBot, channelId: string, guildId?: string, options?: Universal.SendOptions) { |
|
|
|
|
super(bot, channelId, guildId, options) |
|
|
|
|
const chat_id = guildId || channelId |
|
|
|
|
this.payload = { chat_id, parse_mode: 'html', caption: '' } |
|
|
|
|
this.payload = { chat_id, chat_type: Universal.Channel.Type.DIRECT, parse_mode: 'html', caption: '' } |
|
|
|
|
if (guildId && channelId !== guildId) this.payload.message_thread_id = +channelId |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -55,7 +55,7 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
@@ -55,7 +55,7 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
|
|
|
|
|
} |
|
|
|
|
const method = await appendAsset(this.bot, form, this.asset) |
|
|
|
|
const result = await this.bot.internal[method](form as any) |
|
|
|
|
await this.addResult(result) |
|
|
|
|
//await this.addResult(result)
|
|
|
|
|
delete this.payload.reply_to_message_id |
|
|
|
|
this.asset = null |
|
|
|
|
this.payload.caption = '' |
|
|
|
@ -66,8 +66,10 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
@@ -66,8 +66,10 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
|
|
|
|
|
// send previous asset if there is any
|
|
|
|
|
await this.sendAsset() |
|
|
|
|
} else if (this.payload.caption) { |
|
|
|
|
console.info('reply:') |
|
|
|
|
console.info(this.payload); |
|
|
|
|
const result = await this.bot.internal.sendTextMessage({ |
|
|
|
|
chat_type: 1, |
|
|
|
|
chat_type: parseInt(this.payload.chat_type), |
|
|
|
|
chat_id: parseInt(this.payload.chat_id), |
|
|
|
|
text: this.payload.caption |
|
|
|
|
// parse_mode: this.payload.parse_mode,
|
|
|
|
@ -75,7 +77,9 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
@@ -75,7 +77,9 @@ export class PotatoMessageEncoder extends MessageEncoder<PotatoBot> {
|
|
|
|
|
// message_thread_id: this.payload.message_thread_id,
|
|
|
|
|
// disable_web_page_preview: !this.options.linkPreview,
|
|
|
|
|
}) |
|
|
|
|
await this.addResult(result) |
|
|
|
|
console.info('result:') |
|
|
|
|
console.info(result) |
|
|
|
|
//await this.addResult(result)
|
|
|
|
|
delete this.payload.reply_to_message_id |
|
|
|
|
this.payload.caption = '' |
|
|
|
|
} |
|
|
|
|