make guild id and request channel id go into process environment

This commit is contained in:
Soph :3 2025-12-20 12:11:42 +02:00
parent 35726ad44a
commit b21f6594a8

View file

@ -7,9 +7,6 @@ import {
} from "discord.js";
import crypto from "crypto";
const GUILD_ID = "1449756600733798501";
const REQUEST_CHANNEL_ID = "1449767378882920568";
const client = new Client({
intents: [GatewayIntentBits.Guilds],
});
@ -46,7 +43,7 @@ const rest = new REST({ version: "10" }).setToken(process.env.DISCORD_TOKEN);
await rest.put(
Routes.applicationGuildCommands(
(await rest.get(Routes.oauth2CurrentApplication())).id,
GUILD_ID
process.env.GUILD_ID
),
{ body: [command.toJSON()] }
);
@ -123,7 +120,7 @@ client.on("interactionCreate", async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName !== "request") return;
if (interaction.guildId !== GUILD_ID) {
if (interaction.guildId !== process.env.GUILD_ID) {
return interaction.reply({
content: "❌ This command can only be used in the main server.",
flags: {
@ -170,7 +167,7 @@ client.on("interactionCreate", async interaction => {
});
}
const channel = await client.channels.fetch(REQUEST_CHANNEL_ID);
const channel = await client.channels.fetch(process.env.REQUEST_CHANNEL_ID);
await channel.send({
embeds: [
@ -207,7 +204,7 @@ client.on("interactionCreate", async interaction => {
});
}
const channel = await client.channels.fetch(REQUEST_CHANNEL_ID);
const channel = await client.channels.fetch(process.env.REQUEST_CHANNEL_ID);
await channel.send({
embeds: [