Skip to content

Commit f9bbc79

Browse files
committed
🩹 fix: cant reply with an embed
1 parent eaf219e commit f9bbc79

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎src/structures/textChannel.ts‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '../types/endpoint.ts'
1313
import { Collection } from '../utils/collection.ts'
1414
import { Channel } from './channel.ts'
15-
import type { Embed } from './embed.ts'
15+
import { Embed } from './embed.ts'
1616
import { Emoji } from './emoji.ts'
1717
import type { Member } from './member.ts'
1818
import { Message } from './message.ts'
@@ -41,7 +41,6 @@ export class TextChannel extends Channel {
4141
}
4242

4343
/**
44-
*
4544
* @param content Text content of the Message to send.
4645
* @param option Various other Message options.
4746
* @param reply Reference to a Message object to reply-to.
@@ -51,11 +50,17 @@ export class TextChannel extends Channel {
5150
option?: AllMessageOptions,
5251
reply?: Message
5352
): Promise<Message> {
54-
return this.client.channels.sendMessage(
55-
this,
56-
content,
57-
Object.assign(option ?? {}, { reply })
58-
)
53+
if (typeof content === 'object') {
54+
option = content
55+
content = undefined
56+
}
57+
if (option instanceof Array) {
58+
option = { embeds: option }
59+
}
60+
if (option instanceof Embed) {
61+
option = { embeds: [option] }
62+
}
63+
return this.client.channels.sendMessage(this, content, { ...option, reply })
5964
}
6065

6166
/**

0 commit comments

Comments
 (0)