Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions commands/rolekle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { SlashCommandBuilder } = require('discord.js')

module.exports = {
data: new SlashCommandBuilder()
.setName('rolekle')
.setDescription('Bir kullanıcıya rol ekler.')
.addRoleOption((option) => option.setName('rol').setDescription('Rolü seçiniz.').setRequired(true))
.addUserOption((option) => option.setName('kullanıcı').setDescription('Kullanıcıyı seçiniz.').setRequired(true)),

// eslint-disable-next-line consistent-return
async execute(interaction) {
try {
const userroles = interaction.member.roles.cache.map((role) => role.id)
const roles = ['1072134487745511526']

if (!userroles.some((role) => roles.includes(role))) {
return interaction.reply('Bu komutu kullanmak için yetkiniz yok.')
}
const role = interaction.options.getRole('rol')
const user = interaction.options.getUser('kullanıcı')

await interaction.guild.members.cache.get(user.id).roles.add(role)
await interaction.reply(`${user.username} kullanıcısına ${role.name} rolü verildi.`)
} catch (error) {
console.error(error)
console.log(error.rawError)
console.log(error.rawError.message)
await interaction.reply(
`Bir hata oluştu. Lütfen daha sonra tekrar deneyiniz. Hata kodu: ${error.rawError.message}`,
)
}
},
}
33 changes: 33 additions & 0 deletions commands/rolkaldir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { SlashCommandBuilder } = require('discord.js')

module.exports = {
data: new SlashCommandBuilder()
.setName('rolkaldir')
.setDescription('Bir kullanıcıdan rol kaldırır.')
.addRoleOption((option) => option.setName('rol').setDescription('Rolü seçiniz.').setRequired(true))
.addUserOption((option) => option.setName('kullanıcı').setDescription('Kullanıcıyı seçiniz.').setRequired(true)),

// eslint-disable-next-line consistent-return
async execute(interaction) {
try {
const userroles = interaction.member.roles.cache.map((role) => role.id)
const roles = ['1072134487745511526']

if (!userroles.some((role) => roles.includes(role))) {
return interaction.reply('Bu komutu kullanmak için yetkiniz yok.')
}
const role = interaction.options.getRole('rol')
const user = interaction.options.getUser('kullanıcı')

await interaction.guild.members.cache.get(user.id).roles.remove(role)
await interaction.reply(`${user.username} kullanıcısından ${role.name} rolü alındı.`)
} catch (error) {
console.error(error)
console.log(error.rawError)
console.log(error.rawError.message)
await interaction.reply(
`Bir hata oluştu. Lütfen daha sonra tekrar deneyiniz. Hata kodu: ${error.rawError.message}`,
)
}
},
}