Unfragender | Jonas
Unfragender | Jonas
Explore posts from servers
SIASapphire - Imagine a framework
Created by Unfragender | Jonas on 11/9/2023 in #discordjs-support
TypeError: Cannot read properties of undefined (reading 'FLAGS')
Error Code TypeError: Cannot read properties of undefined (reading 'FLAGS')
6 replies
SIASapphire - Imagine a framework
Created by Unfragender | Jonas on 11/9/2023 in #discordjs-support
TypeError: Cannot read properties of undefined (reading 'FLAGS')
await interaction.followUp({ content: `Nutzer ${targetUser.tag} wurde gekickt.`, ephemeral: true });
},
};
await interaction.followUp({ content: `Nutzer ${targetUser.tag} wurde gekickt.`, ephemeral: true });
},
};
6 replies
SIASapphire - Imagine a framework
Created by Unfragender | Jonas on 11/9/2023 in #discordjs-support
TypeError: Cannot read properties of undefined (reading 'FLAGS')
const { SlashCommandBuilder, Permissions } = require('discord.js');
const { EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('kick')
.setDescription('Kick einen Nutzer')
.addUserOption(option =>
option
.setName('target')
.setDescription('Bestimme den Nutzer der gekickt werden soll.')
.setRequired(true))
.addStringOption(option =>
option
.setName('reason')
.setDescription('Gib ein Grund für den Kick an.')
.setRequired(true)),
async execute(interaction) {
await interaction.deferReply();

// Überprüfe die Berechtigung des Benutzers zum Kicken
if (!interaction.member || !interaction.member.permissions?.has(Permissions.FLAGS.KICK_MEMBERS)) {
return interaction.followUp({ content: 'Du hast keine Berechtigung, diesen Befehl zu verwenden.', ephemeral: true });
}

const targetUser = interaction.options.getUser('target');
const reason = interaction.options.getString('reason');

try {
// Kicke den Nutzer
await interaction.guild.members.kick(targetUser, { reason: reason });
} catch (error) {
console.error(error);
return interaction.followUp({ content: 'Fehler beim Kicken des Nutzers.', ephemeral: true });
}

// Erstelle ein Embed für den Kick-Log
const embedBuilder = new EmbedBuilder()
.setTitle('Kick Log')
.setColor('#05a100')
.setDescription(`**Gekickt:** <@${targetUser.id}>\n **Grund:** ${reason} \n **Von:** ${interaction.user.tag}`)
.setTimestamp();

// Sende das Embed in den Log-Channel
const logChannel = interaction.guild.channels.cache.get('1129136681065398442');
if (logChannel) {
logChannel.send({ embeds: [embedBuilder] });
} else {
console.error('Der Channel für den Log wurde nicht gefunden.');
}
const { SlashCommandBuilder, Permissions } = require('discord.js');
const { EmbedBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('kick')
.setDescription('Kick einen Nutzer')
.addUserOption(option =>
option
.setName('target')
.setDescription('Bestimme den Nutzer der gekickt werden soll.')
.setRequired(true))
.addStringOption(option =>
option
.setName('reason')
.setDescription('Gib ein Grund für den Kick an.')
.setRequired(true)),
async execute(interaction) {
await interaction.deferReply();

// Überprüfe die Berechtigung des Benutzers zum Kicken
if (!interaction.member || !interaction.member.permissions?.has(Permissions.FLAGS.KICK_MEMBERS)) {
return interaction.followUp({ content: 'Du hast keine Berechtigung, diesen Befehl zu verwenden.', ephemeral: true });
}

const targetUser = interaction.options.getUser('target');
const reason = interaction.options.getString('reason');

try {
// Kicke den Nutzer
await interaction.guild.members.kick(targetUser, { reason: reason });
} catch (error) {
console.error(error);
return interaction.followUp({ content: 'Fehler beim Kicken des Nutzers.', ephemeral: true });
}

// Erstelle ein Embed für den Kick-Log
const embedBuilder = new EmbedBuilder()
.setTitle('Kick Log')
.setColor('#05a100')
.setDescription(`**Gekickt:** <@${targetUser.id}>\n **Grund:** ${reason} \n **Von:** ${interaction.user.tag}`)
.setTimestamp();

// Sende das Embed in den Log-Channel
const logChannel = interaction.guild.channels.cache.get('1129136681065398442');
if (logChannel) {
logChannel.send({ embeds: [embedBuilder] });
} else {
console.error('Der Channel für den Log wurde nicht gefunden.');
}
6 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
(Kick_Members) permission
No description
28 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
(Kick_Members) permission
FROM THIS
28 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
(Kick_Members) permission
No description
28 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
(Kick_Members) permission
I'm not having a hard time, I've tried the methods the guide gave me, but there are always errors
28 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
(Kick_Members) permission
Bro, I've tried a lot of methods that don't help. Besides, I have no idea how to do it like you told me. I've written to my friend several times, who has been programming JS for years, and even he doesn't really have a clue
28 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
Thank you very much! :D
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
It works!
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
Okay
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
That means?
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
ok
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
I took it from the guide.
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
I have no idea what I should change in the code.
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
But i have no idea
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
Yes..
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
Yes
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
Which script do you need so that you can help me?#
27 replies
DIAdiscord.js - Imagine an app
Created by Unfragender | Jonas on 11/9/2023 in #djs-questions
Unknown Interaction
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;

const command = client.commands.get(interaction.commandName);

if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);

if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
});

const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);

if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}

client.login(token);
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;

const command = client.commands.get(interaction.commandName);

if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(error);

if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
});

const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);

if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}

client.login(token);
27 replies