问题描述
我有一个用户注册的网站.在注册过程中,我要求他们提供他们的不和谐用户,让他们访问我们拥有的不和谐社区.
是否可以为我的公会/频道创建邀请并将其发送给使用discord.js的discord用户?我需要此邀请是唯一的,并且仅限于一种用途.因此,每次用户在网站上注册时,我都需要创建一个新的.
可以创建唯一的邀请,但是您无法将其发送给Discord内部的用户,您需要在网页中显示链接:机器人不能向不在公会中的用户发送消息,以防止发送垃圾邮件.
要创建邀请,您可以使用 GuildChannel.createInvite()
方法:
让newInvite =等待channel.createInvite({maxUses:1,//一次使用后将无效unique:true,//告诉漫游器不要使用现有邀请,这样它将是唯一的maxAge:86400//默认情况下会持续24小时.如果要更改此值,请修改此值(0 =永久存在,以秒为单位的时间)});
I have a site where users register. In the registration process, I ask them to provide their discord user to let them access a discord community we own.
Is it possible to create an invite for my guild/channel and send it to a discord user using discord.js? I need this invite to be unique and limited to one use. So, I need to create a new one everytime a user registers at the site.
It is possible to create a unique invite, but you cannot send it to the user inside Discord, you'll need to show the link in your webpage: bots cannot message users that are not in a mutual guild, to prevent spamming.
To create an invite you can use the GuildChannel.createInvite()
method:
let newInvite = await channel.createInvite({
maxUses: 1, // After one use it will be void
unique: true, // That tells the bot not to use an existing invite so that this will be unique
maxAge: 86400 // By default invites last 24 hours. If you want to change that, modify this (0 = lasts forever, time in seconds)
});
这篇关于创建邀请并将其发送给不在您的服务器/公会中的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!