Skip to content

Commit

Permalink
Minor update (no commands added)
Browse files Browse the repository at this point in the history
  • Loading branch information
exatombe committed Dec 28, 2023
1 parent 0bbf0fc commit c97139b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/bot/class/SelectMenuInteraction.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { FastifyReply } from "fastify";
import InteractionBaseWebhook from "./interaction";
import { APIInteraction } from "discord.js";
import Bot from "..";

export default class SelectMenuInteractionWebhook extends InteractionBaseWebhook {
public componentActual: "button" | "selectMenu" | "unknown" = "unknown";
values: string[];
constructor(data: APIInteraction, bot: Bot, res: FastifyReply) {
super(data, bot, res);
}
}
6 changes: 5 additions & 1 deletion src/bot/class/interaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { APIInteraction, APIInteractionResponse, APIInteractionResponseCallbackData, APIMessage, APIModalComponent, APIModalInteractionResponseCallbackData, AutocompleteInteraction, BaseInteraction, ButtonInteraction, CacheType, Client, Component, InteractionReplyOptions, InteractionResponseType, InteractionType, InteractionWebhook, Message, MessageComponentInteraction, MessagePayload, MessageResolvable, ModalSubmitActionRowComponent, RESTGetAPIWebhookWithTokenMessageResult, Routes, WebhookMessageEditOptions } from "discord.js";
import { APIInteraction, APIInteractionResponse, APIInteractionResponseCallbackData, APIMessage, APIModalComponent, APIModalInteractionResponseCallbackData, AutocompleteInteraction, BaseInteraction, ButtonInteraction, CacheType, Client, Component, ComponentType, InteractionReplyOptions, InteractionResponseType, InteractionType, InteractionWebhook, Message, MessageComponentInteraction, MessagePayload, MessageResolvable, ModalSubmitActionRowComponent, RESTGetAPIWebhookWithTokenMessageResult, Routes, WebhookMessageEditOptions } from "discord.js";
import { FastifyReply } from "fastify";
import AutocompleteInteractionWebHook from "./autoCompleteInteraction";
import CommandInteractionWebHook from "./commandInteraction";
Expand All @@ -14,6 +14,7 @@ export default class InteractionBaseWebhook extends BaseInteraction {
bot: Bot;
components: ModalSubmitActionRowComponent[] = [];
webhook: InteractionWebhook;
values?: string[];
timeCreated: number = Date.now();
constructor(data: APIInteraction, bot: Bot, res: FastifyReply) {
let client = bot.application?.client;
Expand All @@ -28,6 +29,9 @@ export default class InteractionBaseWebhook extends BaseInteraction {
if(data.data) {
if(data.type === InteractionType.MessageComponent) {
this.customId = data.data.custom_id;
if(data.data.component_type === ComponentType.UserSelect || data.data.component_type === ComponentType.StringSelect || data.data.component_type === ComponentType.ChannelSelect || data.data.component_type === ComponentType.MentionableSelect || data.data.component_type === ComponentType.RoleSelect) {
this.values = data.data.values;
}
}
if(data.type === InteractionType.ModalSubmit) {
this.components = data.data.components;
Expand Down

0 comments on commit c97139b

Please sign in to comment.