Java Code Examples for net.dv8tion.jda.api.exceptions.InsufficientPermissionException

The following examples show how to use net.dv8tion.jda.api.exceptions.InsufficientPermissionException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: JuniperBot   Source File: PlayerServiceImpl.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public VoiceChannel connectToChannel(PlaybackInstance instance, Member member) throws DiscordException {
    VoiceChannel channel = getDesiredChannel(member);
    if (channel == null) {
        return null;
    }
    if (!channel.getGuild().getSelfMember().hasPermission(channel,
            Permission.VOICE_CONNECT, Permission.VOICE_SPEAK)) {
        throw new DiscordException("discord.global.voice.noAccess");
    }
    try {
        lavaAudioService.openConnection(instance.getPlayer(), channel);
    } catch (InsufficientPermissionException e) {
        throw new DiscordException("discord.global.voice.noAccess", e);
    }
    return channel;
}
 
Example 2
Source Project: JDA   Source File: MessageBuilder.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a {@link MessageAction MessageAction}
 * with the current settings without building a {@link net.dv8tion.jda.api.entities.Message Message} instance first.
 *
 * @param  channel
 *         The not-null target {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel}
 *
 * @throws java.lang.IllegalArgumentException
 *         If the provided channel is {@code null}
 * @throws net.dv8tion.jda.api.exceptions.PermissionException
 *         If the currently logged in account does not have permission to send or read messages in this channel.
 * @throws java.lang.UnsupportedOperationException
 *         If this is a PrivateChannel and both users (sender and receiver) are bots
 *
 * @return {@link MessageAction MessageAction}
 */
@Nonnull
@CheckReturnValue
public MessageAction sendTo(@Nonnull MessageChannel channel)
{
    Checks.notNull(channel, "Target Channel");
    switch (channel.getType())
    {
        case TEXT:
            final TextChannel text = (TextChannel) channel;
            final Member self = text.getGuild().getSelfMember();
            if (!self.hasPermission(text, Permission.MESSAGE_READ))
                throw new InsufficientPermissionException(text, Permission.MESSAGE_READ);
            if (!self.hasPermission(text, Permission.MESSAGE_WRITE))
                throw new InsufficientPermissionException(text, Permission.MESSAGE_WRITE);
            break;
        case PRIVATE:
            final PrivateChannel priv = (PrivateChannel) channel;
            if (priv.getUser().isBot() && channel.getJDA().getAccountType() == AccountType.BOT)
                throw new UnsupportedOperationException("Cannot send a private message between bots.");
    }
    final Route.CompiledRoute route = Route.Messages.SEND_MESSAGE.compile(channel.getId());
    final MessageActionImpl action = new MessageActionImpl(channel.getJDA(), route, channel, builder);
    return action.tts(isTTS).embed(embed).nonce(nonce);
}
 
Example 3
Source Project: JDA   Source File: AudioManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void checkChannel(VoiceChannel channel, Member self)
{
    EnumSet<Permission> perms = Permission.getPermissions(PermissionUtil.getEffectivePermission(channel, self));
    if (!perms.contains(Permission.VOICE_CONNECT))
        throw new InsufficientPermissionException(channel, Permission.VOICE_CONNECT);
    final int userLimit = channel.getUserLimit(); // userLimit is 0 if no limit is set!
    if (userLimit > 0 && !perms.contains(Permission.ADMINISTRATOR))
    {
        // Check if we can actually join this channel
        // - If there is a userlimit
        // - If that userlimit is reached
        // - If we don't have voice move others permissions
        // VOICE_MOVE_OTHERS allows access because you would be able to move people out to
        // open up a slot anyway
        if (userLimit <= channel.getMembers().size()
            && !perms.contains(Permission.VOICE_MOVE_OTHERS))
        {
            throw new InsufficientPermissionException(channel, Permission.VOICE_MOVE_OTHERS,
                "Unable to connect to VoiceChannel due to userlimit! Requires permission VOICE_MOVE_OTHERS to bypass");
        }
    }
}
 
Example 4
Source Project: JDA   Source File: RoleManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
@CheckReturnValue
public RoleManagerImpl setPermissions(long perms)
{
    long selfPermissions = PermissionUtil.getEffectivePermission(getGuild().getSelfMember());
    setupPermissions();
    long missingPerms = perms;         // include permissions we want to set to
    missingPerms &= ~selfPermissions;  // exclude permissions we have
    missingPerms &= ~this.permissions; // exclude permissions the role has
    // if any permissions remain, we have an issue
    if (missingPerms != 0 && isPermissionChecksEnabled())
    {
        EnumSet<Permission> permissionList = Permission.getPermissions(missingPerms);
        if (!permissionList.isEmpty())
            throw new InsufficientPermissionException(getGuild(), permissionList.iterator().next());
    }
    this.permissions = perms;
    set |= PERMISSION;
    return this;
}
 
Example 5
Source Project: JDA   Source File: ChannelManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
@CheckReturnValue
public ChannelManagerImpl putPermissionOverride(@Nonnull IPermissionHolder permHolder, long allow, long deny)
{
    Checks.notNull(permHolder, "PermissionHolder");
    Checks.check(permHolder.getGuild().equals(getGuild()), "PermissionHolder is not from the same Guild!");
    if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS);
    final long id = getId(permHolder);
    final int type = permHolder instanceof Role ? PermOverrideData.ROLE_TYPE : PermOverrideData.MEMBER_TYPE;
    withLock(lock, (lock) ->
    {
        this.overridesRem.remove(id);
        this.overridesAdd.put(id, new PermOverrideData(type, id, allow, deny));
        set |= PERMISSION;
    });
    return this;
}
 
Example 6
Source Project: JDA   Source File: ChannelManagerImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
@CheckReturnValue
public ChannelManagerImpl removePermissionOverride(@Nonnull IPermissionHolder permHolder)
{
    Checks.notNull(permHolder, "PermissionHolder");
    Checks.check(permHolder.getGuild().equals(getGuild()), "PermissionHolder is not from the same Guild!");
    if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS);
    final long id = getId(permHolder);
    withLock(lock, (lock) ->
    {
        this.overridesRem.add(id);
        this.overridesAdd.remove(id);
        set |= PERMISSION;
    });
    return this;
}
 
Example 7
Source Project: JDA   Source File: AbstractChannelImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public RestAction<List<Invite>> retrieveInvites()
{
    if (!this.getGuild().getSelfMember().hasPermission(this, Permission.MANAGE_CHANNEL))
        throw new InsufficientPermissionException(this, Permission.MANAGE_CHANNEL);

    final Route.CompiledRoute route = Route.Invites.GET_CHANNEL_INVITES.compile(getId());

    JDAImpl jda = (JDAImpl) getJDA();
    return new RestActionImpl<>(jda, route, (response, request) ->
    {
        EntityBuilder entityBuilder = jda.getEntityBuilder();
        DataArray array = response.getArray();
        List<Invite> invites = new ArrayList<>(array.length());
        for (int i = 0; i < array.length(); i++)
            invites.add(entityBuilder.createInvite(array.getObject(i)));
        return Collections.unmodifiableList(invites);
    });
}
 
Example 8
Source Project: JDA   Source File: PermissionOverrideImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public PermissionOverrideAction getManager()
{
    if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS);
    PermissionOverrideAction mng = manager;
    if (mng == null)
    {
        mng = MiscUtil.locked(mngLock, () ->
        {
            if (manager == null)
                manager = new PermissionOverrideActionImpl(this).setOverride(false);
            return manager;
        });
    }
    return mng.reset();
}
 
Example 9
Source Project: JDA   Source File: TextChannelImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public List<CompletableFuture<Void>> purgeMessages(@Nonnull List<? extends Message> messages)
{
    if (messages == null || messages.isEmpty())
        return Collections.emptyList();
    boolean hasPerms = getGuild().getSelfMember().hasPermission(this, Permission.MESSAGE_MANAGE);
    if (!hasPerms)
    {
        for (Message m : messages)
        {
            if (m.getAuthor().equals(getJDA().getSelfUser()))
                continue;
            throw new InsufficientPermissionException(this, Permission.MESSAGE_MANAGE, "Cannot delete messages of other users");
        }
    }
    return TextChannel.super.purgeMessages(messages);
}
 
Example 10
Source Project: JDA   Source File: GuildImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public RestActionImpl<List<Ban>> retrieveBanList()
{
    if (!getSelfMember().hasPermission(Permission.BAN_MEMBERS))
        throw new InsufficientPermissionException(this, Permission.BAN_MEMBERS);

    Route.CompiledRoute route = Route.Guilds.GET_BANS.compile(getId());
    return new RestActionImpl<>(getJDA(), route, (response, request) ->
    {
        EntityBuilder builder = api.getEntityBuilder();
        List<Ban> bans = new LinkedList<>();
        DataArray bannedArr = response.getArray();

        for (int i = 0; i < bannedArr.length(); i++)
        {
            final DataObject object = bannedArr.getObject(i);
            DataObject user = object.getObject("user");
            bans.add(new Ban(builder.createFakeUser(user), object.getString("reason", null)));
        }
        return Collections.unmodifiableList(bans);
    });
}
 
Example 11
Source Project: JDA   Source File: GuildImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public RestAction<Ban> retrieveBanById(@Nonnull String userId)
{
    if (!getSelfMember().hasPermission(Permission.BAN_MEMBERS))
        throw new InsufficientPermissionException(this, Permission.BAN_MEMBERS);

    Checks.isSnowflake(userId, "User ID");

    Route.CompiledRoute route = Route.Guilds.GET_BAN.compile(getId(), userId);
    return new RestActionImpl<>(getJDA(), route, (response, request) ->
    {

        EntityBuilder builder = api.getEntityBuilder();
        DataObject bannedObj = response.getObject();
        DataObject user = bannedObj.getObject("user");
        return new Ban(builder.createFakeUser(user), bannedObj.getString("reason", null));
    });
}
 
Example 12
Source Project: JDA   Source File: GuildImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public RestAction<List<Invite>> retrieveInvites()
{
    if (!this.getSelfMember().hasPermission(Permission.MANAGE_SERVER))
        throw new InsufficientPermissionException(this, Permission.MANAGE_SERVER);

    final Route.CompiledRoute route = Route.Invites.GET_GUILD_INVITES.compile(getId());

    return new RestActionImpl<>(getJDA(), route, (response, request) ->
    {
        EntityBuilder entityBuilder = api.getEntityBuilder();
        DataArray array = response.getArray();
        List<Invite> invites = new ArrayList<>(array.length());
        for (int i = 0; i < array.length(); i++)
            invites.add(entityBuilder.createInvite(array.getObject(i)));
        return Collections.unmodifiableList(invites);
    });
}
 
Example 13
Source Project: JDA   Source File: ChannelOrderActionImpl.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected RequestBody finalizeData()
{
    final Member self = guild.getSelfMember();
    if (!self.hasPermission(Permission.MANAGE_CHANNEL))
        throw new InsufficientPermissionException(guild, Permission.MANAGE_CHANNEL);
    DataArray array = DataArray.empty();
    for (int i = 0; i < orderList.size(); i++)
    {
        GuildChannel chan = orderList.get(i);
        array.add(DataObject.empty()
                .put("id", chan.getId())
                .put("position", i));
    }

    return getRequestBody(array);
}
 
Example 14
Source Project: Lavalink-Client   Source File: JdaLink.java    License: MIT License 5 votes vote down vote up
/**
 * Eventually connect to a channel. Takes care of disconnecting from an existing connection
 *
 * @param channel Channel to connect to
 */
@SuppressWarnings("WeakerAccess")
void connect(VoiceChannel channel, boolean checkChannel) {
    if (!channel.getGuild().equals(getJda().getGuildById(guild)))
        throw new IllegalArgumentException("The provided VoiceChannel is not a part of the Guild that this AudioManager handles." +
                "Please provide a VoiceChannel from the proper Guild");
    if (channel.getJDA().isUnavailable(channel.getGuild().getIdLong()))
        throw new GuildUnavailableException("Cannot open an Audio Connection with an unavailable guild. " +
                "Please wait until this Guild is available to open a connection.");
    final Member self = channel.getGuild().getSelfMember();
    if (!self.hasPermission(channel, Permission.VOICE_CONNECT) && !self.hasPermission(channel, Permission.VOICE_MOVE_OTHERS))
        throw new InsufficientPermissionException(channel, Permission.VOICE_CONNECT);

    //If we are already connected to this VoiceChannel, then do nothing.
    if (checkChannel && channel.equals(channel.getGuild().getSelfMember().getVoiceState().getChannel()))
        return;

    if (channel.getGuild().getSelfMember().getVoiceState().inVoiceChannel()) {
        final int userLimit = channel.getUserLimit(); // userLimit is 0 if no limit is set!
        if (!self.isOwner() && !self.hasPermission(Permission.ADMINISTRATOR)) {
            if (userLimit > 0                                                      // If there is a userlimit
                    && userLimit <= channel.getMembers().size()                    // if that userlimit is reached
                    && !self.hasPermission(channel, Permission.VOICE_MOVE_OTHERS)) // If we don't have voice move others permissions
                throw new InsufficientPermissionException(channel, Permission.VOICE_MOVE_OTHERS, // then throw exception!
                        "Unable to connect to VoiceChannel due to userlimit! Requires permission VOICE_MOVE_OTHERS to bypass");
        }
    }

    setState(State.CONNECTING);
    queueAudioConnect(channel.getIdLong());
}
 
Example 15
Source Project: JDA   Source File: MessageHistory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new MessageHistory object.
 *
 * @param  channel
 *         The {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} to retrieval history from.
 */
public MessageHistory(@Nonnull MessageChannel channel)
{
    Checks.notNull(channel, "Channel");
    this.channel = channel;
    if (channel instanceof TextChannel)
    {
        TextChannel tc = (TextChannel) channel;
        if (!tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_HISTORY))
            throw new InsufficientPermissionException(tc, Permission.MESSAGE_HISTORY);
    }
}
 
Example 16
Source Project: JDA   Source File: MessageHistory.java    License: Apache License 2.0 5 votes vote down vote up
private static void checkArguments(MessageChannel channel, String messageId)
{
    Checks.isSnowflake(messageId, "Message ID");
    Checks.notNull(channel, "Channel");
    if (channel.getType() == ChannelType.TEXT)
    {
        TextChannel t = (TextChannel) channel;
        if (!t.getGuild().getSelfMember().hasPermission(t, Permission.MESSAGE_HISTORY))
            throw new InsufficientPermissionException(t, Permission.MESSAGE_HISTORY);
    }
}
 
Example 17
Source Project: JDA   Source File: PermOverrideManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean checkPermissions()
{
    if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS);
    return super.checkPermissions();
}
 
Example 18
Source Project: JDA   Source File: RoleManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean checkPermissions()
{
    Member selfMember = getGuild().getSelfMember();
    if (!selfMember.hasPermission(Permission.MANAGE_ROLES))
        throw new InsufficientPermissionException(getGuild(), Permission.MANAGE_ROLES);
    if (!selfMember.canInteract(getRole()))
        throw new HierarchyException("Cannot modify a role that is higher or equal in hierarchy");
    return super.checkPermissions();
}
 
Example 19
Source Project: JDA   Source File: WebhookManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean checkPermissions()
{
    if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_WEBHOOKS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_WEBHOOKS);
    return super.checkPermissions();
}
 
Example 20
Source Project: JDA   Source File: ChannelManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
@CheckReturnValue
public ChannelManagerImpl sync(@Nonnull GuildChannel syncSource)
{
    Checks.notNull(syncSource, "SyncSource");
    Checks.check(getGuild().equals(syncSource.getGuild()), "Sync only works for channels of same guild");

    if(syncSource.equals(getChannel()))
        return this;

    if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS);

    withLock(lock, (lock) ->
    {
        this.overridesRem.clear();
        this.overridesAdd.clear();

        //set all current overrides to-be-removed
        getChannel().getPermissionOverrides()
            .stream()
            .mapToLong(PermissionOverride::getIdLong)
            .forEach(overridesRem::add);

        //re-add all perm-overrides of syncSource
        syncSource.getPermissionOverrides().forEach(override -> {
            int type = override.isRoleOverride() ? PermOverrideData.ROLE_TYPE : PermOverrideData.MEMBER_TYPE;
            long id = override.getIdLong();

            this.overridesRem.remove(id);
            this.overridesAdd.put(id, new PermOverrideData(type, id, override.getAllowedRaw(), override.getDeniedRaw()));
        });

        set |= PERMISSION;
    });
    return this;
}
 
Example 21
Source Project: JDA   Source File: ChannelManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean checkPermissions()
{
    final Member selfMember = getGuild().getSelfMember();
    if (!selfMember.hasPermission(getChannel(), Permission.MANAGE_CHANNEL))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_CHANNEL);
    return super.checkPermissions();
}
 
Example 22
Source Project: JDA   Source File: GuildManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean checkPermissions()
{
    if (!getGuild().getSelfMember().hasPermission(Permission.MANAGE_SERVER))
        throw new InsufficientPermissionException(getGuild(), Permission.MANAGE_SERVER);
    return super.checkPermissions();
}
 
Example 23
Source Project: JDA   Source File: EmoteManagerImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean checkPermissions()
{
    if (!getGuild().getSelfMember().hasPermission(Permission.MANAGE_EMOTES))
        throw new InsufficientPermissionException(getGuild(), Permission.MANAGE_EMOTES);
    return super.checkPermissions();
}
 
Example 24
Source Project: JDA   Source File: WebhookImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public AuditableRestAction<Void> delete()
{
    if (token != null)
        return delete(token);

    if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_WEBHOOKS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_WEBHOOKS);

    Route.CompiledRoute route = Route.Webhooks.DELETE_WEBHOOK.compile(getId());
    return new AuditableRestActionImpl<>(getJDA(), route);
}
 
Example 25
Source Project: JDA   Source File: AbstractChannelImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public InviteAction createInvite()
{
    if (!this.getGuild().getSelfMember().hasPermission(this, Permission.CREATE_INSTANT_INVITE))
        throw new InsufficientPermissionException(this, Permission.CREATE_INSTANT_INVITE);

    return new InviteActionImpl(this.getJDA(), this.getId());
}
 
Example 26
Source Project: JDA   Source File: AbstractChannelImpl.java    License: Apache License 2.0 5 votes vote down vote up
protected void checkPermission(Permission permission, String message)
{
    if (!getGuild().getSelfMember().hasPermission(this, permission))
    {
        if (message != null)
            throw new InsufficientPermissionException(this, permission, message);
        else
            throw new InsufficientPermissionException(this, permission);
    }
}
 
Example 27
Source Project: JDA   Source File: PermissionOverrideImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public AuditableRestAction<Void> delete()
{
    if (!getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS))
        throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS);

    Route.CompiledRoute route = Route.Channels.DELETE_PERM_OVERRIDE.compile(channel.getId(), getId());
    return new AuditableRestActionImpl<>(getJDA(), route);
}
 
Example 28
Source Project: JDA   Source File: ReceivedMessage.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public AuditableRestAction<Void> delete()
{
    if (!getJDA().getSelfUser().equals(getAuthor()))
    {
        if (isFromType(ChannelType.PRIVATE))
            throw new IllegalStateException("Cannot delete another User's messages in a PrivateChannel.");
        else if (!getGuild().getSelfMember()
                .hasPermission((TextChannel) getChannel(), Permission.MESSAGE_MANAGE))
            throw new InsufficientPermissionException(getTextChannel(), Permission.MESSAGE_MANAGE);
    }
    return channel.deleteMessageById(getIdLong());
}
 
Example 29
Source Project: JDA   Source File: TextChannelImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public AuditableRestAction<Void> deleteWebhookById(@Nonnull String id)
{
    Checks.isSnowflake(id, "Webhook ID");

    if (!getGuild().getSelfMember().hasPermission(this, Permission.MANAGE_WEBHOOKS))
        throw new InsufficientPermissionException(this, Permission.MANAGE_WEBHOOKS);

    Route.CompiledRoute route = Route.Webhooks.DELETE_WEBHOOK.compile(id);
    return new AuditableRestActionImpl<>(getJDA(), route);
}
 
Example 30
Source Project: JDA   Source File: GuildImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public MemberAction addMember(@Nonnull String accessToken, @Nonnull String userId)
{
    Checks.notBlank(accessToken, "Access-Token");
    Checks.isSnowflake(userId, "User ID");
    Checks.check(getMemberById(userId) == null, "User is already in this guild");
    if (!getSelfMember().hasPermission(Permission.CREATE_INSTANT_INVITE))
        throw new InsufficientPermissionException(this, Permission.CREATE_INSTANT_INVITE);
    return new MemberActionImpl(getJDA(), this, userId, accessToken);
}