【问题标题】:Creating an invite and send it to an user that is not in your server/guild创建邀请并将其发送给不在您的服务器/公会中的用户
【发布时间】:2019-06-25 02:02:00
【问题描述】:

我有一个用户注册的网站。在注册过程中,我要求他们提供他们的 discord 用户,让他们访问我们拥有的 discord 社区。​​p>

是否可以为我的公会/频道创建邀请并使用 discord.js 将其发送给不和谐用户?我需要这个邀请是独一无二的,并且仅限于一次使用。所以,每次用户在网站上注册时,我都需要创建一个新的。

【问题讨论】:

    标签: node.js discord.js


    【解决方案1】:

    可以创建一个独特的邀请,但您不能将其发送给 Discord 中的用户,您需要在您的网页中显示链接:机器人无法向不在共同公会中的用户发送消息,以防止垃圾邮件.

    要创建邀请,您可以使用GuildChannel.createInvite() 方法:

    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)
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-04
      • 2021-03-21
      • 2021-09-24
      • 1970-01-01
      • 1970-01-01
      • 2016-01-09
      • 2011-02-18
      相关资源
      最近更新 更多