AgEnT007
AgEnT007
DIAdiscord.js - Imagine an app
Created by AgEnT007 on 4/26/2024 in #djs-questions
help me to resolve
No description
5 replies
DIAdiscord.js - Imagine an app
Created by AgEnT007 on 4/25/2024 in #djs-questions
my code is not working!
9 replies
DIAdiscord.js - Imagine an app
Created by AgEnT007 on 4/25/2024 in #djs-questions
i can't get multiple roles uisng addroleopts
.addRoleOption(option =>
option
.setName('role')
.setDescription('Select a role to give')
.setRequired(true)


)
.addRoleOption(option =>
option
.setName('role')
.setDescription('Select a role to give')
.setRequired(true)


)
7 replies
DIAdiscord.js - Imagine an app
Created by AgEnT007 on 4/21/2024 in #djs-questions
help
const { SlashCommandBuilder, PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, } = require('discord.js');
const ban = require('../../database-modals/ban-modal')
const officialBotId = '1226406827823206461'
module.exports = {
data: new SlashCommandBuilder()
.setName('ban')
.setDescription('Ban a user')
.addUserOption(option =>
option.setName('target')
.setDescription('The user to ban')
.setRequired(true))
.addStringOption(option =>
option.setName('reason')
.setDescription('The reason for banning')
.setRequired(true)
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator || PermissionFlagsBits.ModerateMembers),
async execute(interaction) {
await interaction.guild.members.fetch(); // R

const user = interaction.options.getUser('target');
const data = await ban.findOne({ userId: user.id })
// const totalRoles = interaction.guild.roles.cache.size;

if (data) {
return interaction.reply('user is already banned')
} else {
if (user.id === officialBotId) return interaction.reply(`You cannot ban our official bot`);
const targetMember = interaction.guild.members.cache.get(user.id);
const executorMember = interaction.guild.members.cache.get(interaction.user.id);
// executorMember.setPosition(totalRoles)
if (targetMember.roles.highest.position >= executorMember.roles.highest.position) {
console.log(targetMember.roles.highest.position, executorMember.roles.highest.position)
return interaction.reply(`You cannot ban ${user.tag} as their role position is higher than or equal to yours.`);
}
}
const { SlashCommandBuilder, PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, } = require('discord.js');
const ban = require('../../database-modals/ban-modal')
const officialBotId = '1226406827823206461'
module.exports = {
data: new SlashCommandBuilder()
.setName('ban')
.setDescription('Ban a user')
.addUserOption(option =>
option.setName('target')
.setDescription('The user to ban')
.setRequired(true))
.addStringOption(option =>
option.setName('reason')
.setDescription('The reason for banning')
.setRequired(true)
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator || PermissionFlagsBits.ModerateMembers),
async execute(interaction) {
await interaction.guild.members.fetch(); // R

const user = interaction.options.getUser('target');
const data = await ban.findOne({ userId: user.id })
// const totalRoles = interaction.guild.roles.cache.size;

if (data) {
return interaction.reply('user is already banned')
} else {
if (user.id === officialBotId) return interaction.reply(`You cannot ban our official bot`);
const targetMember = interaction.guild.members.cache.get(user.id);
const executorMember = interaction.guild.members.cache.get(interaction.user.id);
// executorMember.setPosition(totalRoles)
if (targetMember.roles.highest.position >= executorMember.roles.highest.position) {
console.log(targetMember.roles.highest.position, executorMember.roles.highest.position)
return interaction.reply(`You cannot ban ${user.tag} as their role position is higher than or equal to yours.`);
}
}
13 replies
DIAdiscord.js - Imagine an app
Created by AgEnT007 on 4/20/2024 in #djs-questions
automod example
I need an example code for making automod
15 replies
DIAdiscord.js - Imagine an app
Created by AgEnT007 on 4/20/2024 in #djs-questions
spam related
How to make a slash command to prevent spamming in server
11 replies