Skip to content

Commit

Permalink
🩹 fix: cant reply with an embed
Browse files Browse the repository at this point in the history
  • Loading branch information
Helloyunho committed Jan 9, 2023
1 parent eaf219e commit f9bbc79
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/structures/textChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '../types/endpoint.ts'
import { Collection } from '../utils/collection.ts'
import { Channel } from './channel.ts'
import type { Embed } from './embed.ts'
import { Embed } from './embed.ts'
import { Emoji } from './emoji.ts'
import type { Member } from './member.ts'
import { Message } from './message.ts'
Expand Down Expand Up @@ -41,7 +41,6 @@ export class TextChannel extends Channel {
}

/**
*
* @param content Text content of the Message to send.
* @param option Various other Message options.
* @param reply Reference to a Message object to reply-to.
Expand All @@ -51,11 +50,17 @@ export class TextChannel extends Channel {
option?: AllMessageOptions,
reply?: Message
): Promise<Message> {
return this.client.channels.sendMessage(
this,
content,
Object.assign(option ?? {}, { reply })
)
if (typeof content === 'object') {
option = content
content = undefined
}
if (option instanceof Array) {
option = { embeds: option }
}
if (option instanceof Embed) {
option = { embeds: [option] }
}
return this.client.channels.sendMessage(this, content, { ...option, reply })
}

/**
Expand Down

0 comments on commit f9bbc79

Please sign in to comment.