[英]Discord.js v12 How to get the id of a person who reacted on a specific message?
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.
所以首先机器人发送了一个嵌入,如果你想创建一张票,你可以在其中做出反应(当你做出反应时,机器人将在特定类别中创建一个新频道)。我更改了这个类别的权限,所以@everyone 看不到那个频道。
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您可以使用
GuildChannel.create(name, options)
方法中的options.permissionOverwrites[]
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);
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.