refactor: channel ids moved + add tokenless config

This commit is contained in:
ethanf 2023-11-25 13:28:11 -06:00
parent aec6d6c98e
commit 949a08956a
3 changed files with 20 additions and 14 deletions

10
config.json Normal file
View File

@ -0,0 +1,10 @@
{
"TOKEN": "redacted",
"CLIENT_ID": "1177748390092742767",
"GUILD_ID": "658490352189046784",
"COMMAND_CHANNEL_ID": "1177469184192565288",
"ADDUP_ID": "1175649994674544721",
"BLU_ID": "1175649793943552010",
"RED_ID": "1175649777648680971",
"FK_ID": "1176396207183106078"
}

View File

@ -1,5 +1,6 @@
import { Client, GatewayIntentBits } from "discord.js";
const { token } = require("./config.json");
const { TOKEN, COMMAND_CHANNEL_ID, ADDUP_ID, BLU_ID, RED_ID, FK_ID } = require("./config.json");
const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
});
@ -11,7 +12,7 @@ client.on("ready", () => {
client.on("interactionCreate", async (interaction) => {
if (!interaction.isChatInputCommand()) return;
if (interaction.channelId !== "1177469184192565288") {
if (interaction.channelId !== COMMAND_CHANNEL_ID) {
await interaction.reply({
content: "wrong channel, or you lack the required permissions",
ephemeral: true,
@ -31,18 +32,15 @@ client.on("interactionCreate", async (interaction) => {
// get voice channels
const blu = interaction.guild.channels.cache.find(
(channel) =>
channel.name === "blu" || channel.id === "1175649793943552010"
(channel) => channel.name === "blu" || channel.id === BLU_ID
);
if (!blu) return console.error("Can't find channel 'blu'!");
const red = interaction.guild.channels.cache.find(
(channel) =>
channel.name === "red" || channel.id === "1175649777648680971"
(channel) => channel.name === "red" || channel.id === RED_ID
);
if (!red) return console.error("Can't find channel 'red'!");
const addup = interaction.guild.channels.cache.find(
(channel) =>
channel.name === "add-up" || channel.id === "1175649994674544721"
(channel) => channel.name === "add-up" || channel.id === ADDUP_ID
);
if (!addup) return console.error("Can't find channel 'add-up'!");
@ -86,13 +84,11 @@ client.on("interactionCreate", async (interaction) => {
// get voice channels
const addup = interaction.guild.channels.cache.find(
(channel) =>
channel.name === "add-up" || channel.id === "1175649994674544721"
(channel) => channel.name === "add-up" || channel.id === ADDUP_ID
);
if (!addup) return console.error("Can't find channel 'add-up'!");
const fk = interaction.guild.channels.cache.find(
(channel) =>
channel.name === "fatkid" || channel.id === "1176396207183106078"
(channel) => channel.name === "fatkid" || channel.id === FK_ID
);
if (!fk) return console.error("Can't find channel 'fatkid'!");
@ -131,4 +127,4 @@ client.on("interactionCreate", async (interaction) => {
}
});
client.login(token);
client.login(TOKEN);

View File

@ -1,5 +1,5 @@
import { REST, Routes } from "discord.js";
const { token, client_id, guild_id } = require("./config.json");
const { token, client_id } = require("./config.json");
const commands = [
{