error handling
This commit is contained in:
parent
df291c7d00
commit
7d13506b41
1 changed files with 27 additions and 1 deletions
28
index.js
28
index.js
|
@ -4,7 +4,9 @@ const {
|
|||
ApplicationCommandTypes,
|
||||
InteractionTypes,
|
||||
ApplicationIntegrationTypes,
|
||||
InteractionContextTypes
|
||||
InteractionContextTypes,
|
||||
MessageFlags,
|
||||
ComponentTypes
|
||||
} = require("oceanic.js");
|
||||
|
||||
const client = new Client({
|
||||
|
@ -38,6 +40,12 @@ client.on("ready", () => {
|
|||
description: "...",
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false
|
||||
},
|
||||
{
|
||||
name: "cv2",
|
||||
description: "...",
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -58,6 +66,18 @@ client.on("interactionCreate", async (interaction) => {
|
|||
if (interaction.data.type === ApplicationCommandTypes.CHAT_INPUT) {
|
||||
const content = interaction.data.options.getString("content", true);
|
||||
const raw = interaction.data.options.getBoolean("raw");
|
||||
const cv2Text = interaction.data.options.getBoolean("cv2");
|
||||
|
||||
if (cv2Text)
|
||||
interaction.createFollowup({
|
||||
flags: MessageFlags.IS_UIKIT_COMPONENTS,
|
||||
components: [
|
||||
{
|
||||
type: ComponentTypes.TEXT,
|
||||
content
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
interaction.createFollowup(
|
||||
raw
|
||||
|
@ -70,4 +90,10 @@ client.on("interactionCreate", async (interaction) => {
|
|||
}
|
||||
});
|
||||
|
||||
process.on("uncaughtException", (e) => {
|
||||
client.rest.channels.createMessage("1367826538665476236", {
|
||||
content: "```\n" + e.stack || e.message + "\n```"
|
||||
});
|
||||
});
|
||||
|
||||
client.connect();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue