summaryrefslogtreecommitdiff
path: root/src/register.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-09-09 18:16:44 -0700
committerFuwn <[email protected]>2025-09-09 18:16:44 -0700
commit8baec3564fccac1a7743ac9de481f54e0808c0c9 (patch)
treee29b09fb158539a15df8a5a10bb484666fb22c2d /src/register.ts
parentrefactor(src): Use arrow functions everywhere (diff)
downloadumabotdiscord-8baec3564fccac1a7743ac9de481f54e0808c0c9.tar.xz
umabotdiscord-8baec3564fccac1a7743ac9de481f54e0808c0c9.zip
style: Use base prettier:recommended rules
Diffstat (limited to 'src/register.ts')
-rw-r--r--src/register.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/register.ts b/src/register.ts
index 319b054..6cd2bac 100644
--- a/src/register.ts
+++ b/src/register.ts
@@ -4,21 +4,21 @@ import {
ROLEPLAY_COMMAND,
TOP_COMMAND,
type DiscordCommand,
-} from './discord/commands.ts';
-import dotenv from 'dotenv';
-import process from 'node:process';
+} from "./discord/commands.ts";
+import dotenv from "dotenv";
+import process from "node:process";
-dotenv.config({ path: '.dev.vars' });
+dotenv.config({ path: ".dev.vars" });
const token = process.env.DISCORD_TOKEN;
const applicationID = process.env.DISCORD_APPLICATION_ID;
if (!token)
- throw new Error('The DISCORD_TOKEN environment variable is required.');
+ throw new Error("The DISCORD_TOKEN environment variable is required.");
if (!applicationID)
throw new Error(
- 'The DISCORD_APPLICATION_ID environment variable is required.',
+ "The DISCORD_APPLICATION_ID environment variable is required.",
);
const url = `https://discord.com/api/v10/applications/${applicationID}/commands`;
@@ -32,21 +32,21 @@ const commands: DiscordCommand[] = [
const response = await fetch(url, {
headers: {
- 'Content-Type': 'application/json',
+ "Content-Type": "application/json",
Authorization: `Bot ${token}`,
},
- method: 'PUT',
+ method: "PUT",
body: JSON.stringify(commands),
});
if (response.ok) {
- console.log('Registered all commands');
+ console.log("Registered all commands");
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
} else {
- console.error('Error registering commands');
+ console.error("Error registering commands");
let errorText = `Error registering commands \n ${response.url}: ${response.status} ${response.statusText}`;
@@ -55,7 +55,7 @@ if (response.ok) {
if (error) errorText = `${errorText} \n\n ${error}`;
} catch (error) {
- console.error('Error reading body from request:', error);
+ console.error("Error reading body from request:", error);
}
console.error(errorText);