summaryrefslogtreecommitdiff
path: root/src/register.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/register.js')
-rw-r--r--src/register.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/register.js b/src/register.js
deleted file mode 100644
index 5b374d1..0000000
--- a/src/register.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import {
- HOT_COMMAND,
- NSFW_COMMAND,
- ROLEPLAY_COMMAND,
- TOP_COMMAND,
-} from './commands.js';
-import dotenv from 'dotenv';
-import process from 'node:process';
-
-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.');
-
-if (!applicationID)
- throw new Error(
- 'The DISCORD_APPLICATION_ID environment variable is required.',
- );
-
-const url = `https://discord.com/api/v10/applications/${applicationID}/commands`;
-
-const response = await fetch(url, {
- headers: {
- 'Content-Type': 'application/json',
- Authorization: `Bot ${token}`,
- },
- method: 'PUT',
- body: JSON.stringify([
- HOT_COMMAND,
- ROLEPLAY_COMMAND,
- NSFW_COMMAND,
- TOP_COMMAND,
- ]),
-});
-
-if (response.ok) {
- console.log('Registered all commands');
-
- const data = await response.json();
-
- console.log(JSON.stringify(data, null, 2));
-} else {
- console.error('Error registering commands');
-
- let errorText = `Error registering commands \n ${response.url}: ${response.status} ${response.statusText}`;
-
- try {
- const error = await response.text();
-
- if (error) errorText = `${errorText} \n\n ${error}`;
- } catch (error) {
- console.error('Error reading body from request:', error);
- }
-
- console.error(errorText);
-}