-
-
Notifications
You must be signed in to change notification settings - Fork 251
/
add.js
44 lines (42 loc) · 1.16 KB
/
add.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const {
SlashCommandBuilder
} = require('@discordjs/builders');
module.exports = {
data: new SlashCommandBuilder()
.setName('add')
.setDescription('add a user')
.addUserOption(option =>
option.setName('target')
.setDescription('add a Member to the ticket')
.setRequired(true)),
async execute(interaction, client) {
const chan = client.channels.cache.get(interaction.channelId);
const user = interaction.options.getUser('target');
if (chan.name.includes('ticket')) {
chan.edit({
permissionOverwrites: [{
id: user,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
},
{
id: interaction.guild.roles.everyone,
deny: ['VIEW_CHANNEL'],
},
{
id: client.config.roleSupport,
allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'],
},
],
}).then(async () => {
interaction.reply({
content: `<@${user.id}> has ben addet!`
});
});
} else {
interaction.reply({
content: 'you dont have a ticket!',
ephemeral: true
});
};
},
};