Added message select menues (mentionable not available)

This commit is contained in:
ION606
2023-04-16 19:50:45 -04:00
parent ed16d4aeca
commit 7996d6af7c
16 changed files with 313 additions and 51 deletions
+18 -15
View File
@@ -65,23 +65,26 @@ export class Channel extends DataManager {
*/
async send(inp) {
return new Promise(async (resolve) => {
const content = (typeof inp == 'string') ? inp : inp.content;
var embds = undefined;
if (inp.embeds) {
embds = [];
for (const i of inp.embeds) {
embds.push(i.toJSON());
try {
var embds = undefined;
if (inp.embeds) {
embds = [];
for (const i of inp.embeds) {
embds.push(i.toJSON());
}
}
var toSend = (typeof inp == 'string') ? { content: inp } : structuredClone(inp);
toSend["embeds"] = embds;
toSend["message_reference"] = inp.message_reference || undefined;
toSend = Object.fromEntries(Object.entries(toSend).filter((o) => o[1] != undefined));
const response = await this.client.axiosCustom.post(`/channels/${this.id}/messages`, toSend);
resolve(new message(response.data, this.client));
} catch (err) {
throw err;
}
const toSend = (typeof inp == 'string') ? { content: inp } : structuredClone(inp);
toSend["embeds"] = embds;
toSend["message_reference"] = inp.message_reference || undefined;
const response = await this.client.axiosCustom.post(`/channels/${this.id}/messages`, toSend);
resolve(new message(response.data, this.client));
});
}