catch throws
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ButtonInteraction, Client, GuildMember, Interaction, MessageButton, MessageSelectMenu, SelectMenuInteraction } from "discord.js";
|
import { ButtonInteraction, Client, GuildMember, Interaction, MessageButton, MessageSelectMenu, SelectMenuInteraction } from "discord.js";
|
||||||
import { emsg } from "discordslash";
|
import { emsg, errorMessage } from "discordslash";
|
||||||
import * as Opt from "../types/Opt";
|
import * as Opt from "../types/Opt";
|
||||||
import { getGuild, getMember } from "../util/discord";
|
import { getGuild, getMember } from "../util/discord";
|
||||||
|
|
||||||
@@ -13,7 +13,9 @@ export function initRolemanager(client: Client) {
|
|||||||
//on interaction event
|
//on interaction event
|
||||||
client.on('interactionCreate', (interaction: Interaction) => {
|
client.on('interactionCreate', (interaction: Interaction) => {
|
||||||
|
|
||||||
if (interaction.inGuild()) {
|
if (!interaction.inGuild()) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
if (interaction.isSelectMenu())
|
if (interaction.isSelectMenu())
|
||||||
handleSelect(interaction as SelectMenuInteraction);
|
handleSelect(interaction as SelectMenuInteraction);
|
||||||
@@ -21,9 +23,11 @@ export function initRolemanager(client: Client) {
|
|||||||
else if (interaction.isButton())
|
else if (interaction.isButton())
|
||||||
handleButton(interaction as ButtonInteraction);
|
handleButton(interaction as ButtonInteraction);
|
||||||
|
|
||||||
}
|
} catch (e) {
|
||||||
|
|
||||||
//todo handle throws
|
console.error(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user