Im making my own ticket bot right now. So first of all the bot sent a embed where you can react if you want to create a ticket (When you react the bot will create a new channel in a specific category).I changed the permissions of this category so that @everyone cant see that channel.
My question is how to change the permission so that the user who reacted can write and see his ticket-channel.
My code is:
client.on('messageReactionAdd', async (reactionReaction, user) => {
const message = reactionReaction.message;
const verifyChannel = message.guild.channels.cache.get('724929149755719751');
const member = message.guild.members.cache.get(user.id);
const guild = message.guild;
if (member.user.bot) return;
if (reactionReaction.emoji.name === '🧨' && message.channel.id === verifyChannel.id) {
guild.channels.create('Factions', { type: 'text', parent: '724929049612386375' });
await reactionReaction.users.remove(member).catch(console.error);
}
});
Thank you for helping!
You can use options.permissionOverwrites[]
from the GuildChannel.create(name, options)
method
client.on("messageReactionAdd", async (reactionReaction, user) => {
const message = reactionReaction.message;
const verifyChannel = message.guild.channels.cache.get("724929149755719751");
const member = message.guild.members.cache.get(user.id);
const guild = message.guild;
if (member.user.bot) return;
if (
reactionReaction.emoji.name === "🧨" &&
message.channel.id === verifyChannel.id
) {
guild.channels.create("Factions", {
type: "text",
parent: "724929049612386375",
permissionOverwrites: [
{
id: user.id,
allow: ["VIEW_CHANNEL", "SEND_MESSAGES"],
},
],
});
await reactionReaction.users.remove(member).catch(console.error);
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.