Skip to content

Commit

Permalink
get Guild from .env
Browse files Browse the repository at this point in the history
  • Loading branch information
johan-t committed Sep 24, 2023
1 parent eefa731 commit 071878c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion commands/test/test-command.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, SlashCommandBuilder, Guild, Role } from 'discord.js';
import { client, db } from '../../index';
import cron from 'cron';
import 'dotenv/config'

const questions = [
{ question: 'Auf allen Autobahnen soll ein generelles Tempolimit gelten.', tag: ['Verkehrssicherheit', ' Klimawandel'] },
Expand Down Expand Up @@ -291,11 +292,17 @@ async function findMatchingUser(userId: string, userResponses: number[]): Promis
}

function verifyUser(interaction: any) {
const guild: Guild | undefined = client.guilds.cache.get('1119231777391788062');
const guildId = process.env.GUILD_ID;
if (!guildId) {
console.error('GUILD_ID is not defined in .env');
return;
}
const guild: Guild | undefined = client.guilds.cache.get(guildId);
if (!guild) {
console.error('Guild not found');
return;
}

const role: Role | undefined = guild.roles.cache.get('1153647196449820755');
if (!role) {
console.error('Role not found');
Expand Down

0 comments on commit 071878c

Please sign in to comment.