refactor: channel ids moved + add tokenless config
This commit is contained in:
parent
aec6d6c98e
commit
949a08956a
10
config.json
Normal file
10
config.json
Normal 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"
|
||||||
|
}
|
||||||
22
index.js
22
index.js
@ -1,5 +1,6 @@
|
|||||||
import { Client, GatewayIntentBits } from "discord.js";
|
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({
|
const client = new Client({
|
||||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
|
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
|
||||||
});
|
});
|
||||||
@ -11,7 +12,7 @@ client.on("ready", () => {
|
|||||||
client.on("interactionCreate", async (interaction) => {
|
client.on("interactionCreate", async (interaction) => {
|
||||||
if (!interaction.isChatInputCommand()) return;
|
if (!interaction.isChatInputCommand()) return;
|
||||||
|
|
||||||
if (interaction.channelId !== "1177469184192565288") {
|
if (interaction.channelId !== COMMAND_CHANNEL_ID) {
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
content: "wrong channel, or you lack the required permissions",
|
content: "wrong channel, or you lack the required permissions",
|
||||||
ephemeral: true,
|
ephemeral: true,
|
||||||
@ -31,18 +32,15 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
|
|
||||||
// get voice channels
|
// get voice channels
|
||||||
const blu = interaction.guild.channels.cache.find(
|
const blu = interaction.guild.channels.cache.find(
|
||||||
(channel) =>
|
(channel) => channel.name === "blu" || channel.id === BLU_ID
|
||||||
channel.name === "blu" || channel.id === "1175649793943552010"
|
|
||||||
);
|
);
|
||||||
if (!blu) return console.error("Can't find channel 'blu'!");
|
if (!blu) return console.error("Can't find channel 'blu'!");
|
||||||
const red = interaction.guild.channels.cache.find(
|
const red = interaction.guild.channels.cache.find(
|
||||||
(channel) =>
|
(channel) => channel.name === "red" || channel.id === RED_ID
|
||||||
channel.name === "red" || channel.id === "1175649777648680971"
|
|
||||||
);
|
);
|
||||||
if (!red) return console.error("Can't find channel 'red'!");
|
if (!red) return console.error("Can't find channel 'red'!");
|
||||||
const addup = interaction.guild.channels.cache.find(
|
const addup = interaction.guild.channels.cache.find(
|
||||||
(channel) =>
|
(channel) => channel.name === "add-up" || channel.id === ADDUP_ID
|
||||||
channel.name === "add-up" || channel.id === "1175649994674544721"
|
|
||||||
);
|
);
|
||||||
if (!addup) return console.error("Can't find channel 'add-up'!");
|
if (!addup) return console.error("Can't find channel 'add-up'!");
|
||||||
|
|
||||||
@ -86,13 +84,11 @@ client.on("interactionCreate", async (interaction) => {
|
|||||||
|
|
||||||
// get voice channels
|
// get voice channels
|
||||||
const addup = interaction.guild.channels.cache.find(
|
const addup = interaction.guild.channels.cache.find(
|
||||||
(channel) =>
|
(channel) => channel.name === "add-up" || channel.id === ADDUP_ID
|
||||||
channel.name === "add-up" || channel.id === "1175649994674544721"
|
|
||||||
);
|
);
|
||||||
if (!addup) return console.error("Can't find channel 'add-up'!");
|
if (!addup) return console.error("Can't find channel 'add-up'!");
|
||||||
const fk = interaction.guild.channels.cache.find(
|
const fk = interaction.guild.channels.cache.find(
|
||||||
(channel) =>
|
(channel) => channel.name === "fatkid" || channel.id === FK_ID
|
||||||
channel.name === "fatkid" || channel.id === "1176396207183106078"
|
|
||||||
);
|
);
|
||||||
if (!fk) return console.error("Can't find channel 'fatkid'!");
|
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);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { REST, Routes } from "discord.js";
|
import { REST, Routes } from "discord.js";
|
||||||
const { token, client_id, guild_id } = require("./config.json");
|
const { token, client_id } = require("./config.json");
|
||||||
|
|
||||||
const commands = [
|
const commands = [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user