vekizxo
vekizxo
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
timestamp
example pls
13 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
timestamp
how
13 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
timestamp
?
13 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
timestamp
Math.floor(Date.now() +convertDurationToMS(duration))
Math.floor(Date.now() +convertDurationToMS(duration))
13 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
thx
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
all work. one more question, how can I make it so that instead of indicating minutes I could indicate 1d 2d 1m 1s
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
No description
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
right?
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
if (!interaction.member.permissions.has(PermissionFlagsBits.MANAGE_ROLES)) {
if (!interaction.member.permissions.has(PermissionFlagsBits.MANAGE_ROLES)) {
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
how is it similar to v13
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
what should i change
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
I read it but didn't understand it
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
I don't really understand what exactly I need to do
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
command code
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 6/9/2024 in #djs-questions
commands isnt work
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Permissions } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('giverole')
.setDescription('Выдает временную роль пользователю')
.addUserOption(option => option.setName('user').setDescription('Пользователь, которому будет выдана роль').setRequired(true))
.addRoleOption(option => option.setName('role').setDescription('Роль, которая будет выдана пользователю').setRequired(true))
.addIntegerOption(option => option.setName('duration').setDescription('Длительность роли в минутах (0 - навсегда)').setRequired(true)),
async execute(interaction) {
const user = interaction.options.getUser('user');
const role = interaction.options.getRole('role');
const duration = interaction.options.getInteger('duration');

if (!interaction.member.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) {
return interaction.reply({ content: 'У вас недостаточно прав для выдачи ролей.', ephemeral: true });
}

if (role.position >= interaction.member.roles.highest.position) {
return interaction.reply({ content: 'Вы не можете выдать роль, которая находится выше вашей.', ephemeral: true });
}

const member = await interaction.guild.members.fetch(user.id);

if (duration === 0) {
await member.roles.add(role);
return interaction.reply(`{ content: Роль ${role.name} выдана пользователю ${user.username} навсегда., ephemeral: true }`);
} else {
await member.roles.add(role);
setTimeout(() => {
member.roles.remove(role);
}, duration * 60 * 1000);
return interaction.reply(`{ content: Роль ${role.name} выдана пользователю ${user.username} на ${duration} минут., ephemeral: true }`);
}
},
};
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Permissions } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('giverole')
.setDescription('Выдает временную роль пользователю')
.addUserOption(option => option.setName('user').setDescription('Пользователь, которому будет выдана роль').setRequired(true))
.addRoleOption(option => option.setName('role').setDescription('Роль, которая будет выдана пользователю').setRequired(true))
.addIntegerOption(option => option.setName('duration').setDescription('Длительность роли в минутах (0 - навсегда)').setRequired(true)),
async execute(interaction) {
const user = interaction.options.getUser('user');
const role = interaction.options.getRole('role');
const duration = interaction.options.getInteger('duration');

if (!interaction.member.permissions.has(Permissions.FLAGS.MANAGE_ROLES)) {
return interaction.reply({ content: 'У вас недостаточно прав для выдачи ролей.', ephemeral: true });
}

if (role.position >= interaction.member.roles.highest.position) {
return interaction.reply({ content: 'Вы не можете выдать роль, которая находится выше вашей.', ephemeral: true });
}

const member = await interaction.guild.members.fetch(user.id);

if (duration === 0) {
await member.roles.add(role);
return interaction.reply(`{ content: Роль ${role.name} выдана пользователю ${user.username} навсегда., ephemeral: true }`);
} else {
await member.roles.add(role);
setTimeout(() => {
member.roles.remove(role);
}, duration * 60 * 1000);
return interaction.reply(`{ content: Роль ${role.name} выдана пользователю ${user.username} на ${duration} минут., ephemeral: true }`);
}
},
};
21 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 3/24/2024 in #djs-questions
error
this
24 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 3/24/2024 in #djs-questions
error
.addUserOption(option => option.setName('target').setDescription('The user'))
24 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 3/24/2024 in #djs-questions
error
and also, how to make the option argument mandatory?
24 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 3/24/2024 in #djs-questions
error
work
24 replies
DIAdiscord.js - Imagine an app
Created by vekizxo on 3/24/2024 in #djs-questions
error
error when executing a command
24 replies