Creating an invite and send it to an user that is not in your server/guild

后端 未结 1 1267
傲寒
傲寒 2021-01-27 03:13

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 t

相关标签:
1条回答
  • 2021-01-27 03:43

    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)
    });
    
    0 讨论(0)
提交回复
热议问题