Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric committed Jun 19, 2023
1 parent 8dd5079 commit c6f2e86
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/ws.message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,30 +137,32 @@ export class WsMessage {
this.messageUpdate(message);
}
private messageUpdate(message: any) {
// this.log("messageUpdate", JSON.stringify(message));
const { content, embeds, interaction = {}, nonce, id } = message;

const { content, embeds, interaction, nonce, id } = message;
//settings
if (interaction.name === "settings" && !nonce) {
this.emit("settings", message);
return;
}
//describe
if (interaction.name === "describe" && !nonce) {
this.emitDescribe(id, embeds[0].description);
}
//info
if (interaction.name === "info" && !nonce) {
this.emit("info", embeds[0].description);
return;
if (!nonce) {
const { name } = interaction;

switch (name) {
case "settings":
this.emit("settings", message);
return;
case "describe":
this.emitDescribe(id, embeds?.[0]?.description);
break;
case "info":
this.emit("info", embeds?.[0]?.description);
return;
}
}
if (content === "") {
return;
if (content) {
this.processingImage(message);
}
this.processingImage(message);
}
private processingImage(message: any) {
const { content, id, attachments, flags } = message;
const { content = "", id, attachments, flags } = message;
if (!content) {
return;
}
const event = this.getEventById(id);
if (!event) {
return;
Expand Down

0 comments on commit c6f2e86

Please sign in to comment.