Java 类net.dv8tion.jda.core.entities.Invite 实例源码

项目:Amme    文件:Guild.java   
@Override
public void action(String[] args, GuildMessageReceivedEvent event) throws ParseException, IOException {
    List<Invite> i = event.getGuild().getInvites().complete();
    if(i.get(0).isTemporary() || i.get(0).toString().equals(null)){
       link = event.getChannel().createInvite().setTemporary(false).complete();
    } else {
        link = i.get(0);
    }
    event.getChannel().sendMessage(new EmbedBuilder()
    .setColor(Color.cyan)
    .setTitle("*Guild Info for* **" + event.getGuild().getName() + "**!")
    .setDescription("**Guild Invite** : " + link.getURL().toString() + "\n\n" + "**Total of Users** : " + event.getGuild().getMembers().size() + "\n\n" + "**The Owner is** : " + event.getGuild().getOwner().getAsMention() + "\n\n")
    .build()
    ).queue();
}
项目:Amme    文件:test.java   
@Override
    public void action(String[] args, GuildMessageReceivedEvent event) throws ParseException, IOException {
if (core.permissionHandler.check(4,event)) return;
       Invite i = event.getJDA().getGuildById("315886866903859202").getTextChannels().get(0).createInvite().complete();
        System.out.println(i.getURL());

    }
项目:Phonon    文件:DiscordBot.java   
/**
 * Used to get an active discord invite from a specific guild.
 * @param guildID the guild id
 */
public Optional<Object> getActiveDiscordInvite(String guildID) {
    List<Invite> invites = getJda().getGuildById(guildID).getInvites().complete();
    for (Invite invite : invites) {
        if (!invite.isTemporary() && invite.getUses() < invite.getMaxUses()) return Optional.of(invite);
    }
    return Optional.empty();
}
项目:wolfia    文件:PrivateGuild.java   
public void endUsage() {
    synchronized (usageLock) {
        if (!this.inUse) {
            throw new IllegalStateException("Can't end the usage of a private guild #" + this.privateGuildNumber + " that is not in use ");
        }
        cleanUpMembers();
        try {//complete() in here to catch errors
            //revoke all invites
            for (final TextChannel channel : fetchThisGuild().getTextChannels()) {
                final List<Invite> invites = channel.getInvites().complete();
                invites.forEach(i -> i.delete().complete());
            }
            final TextChannel tc = Wolfia.getTextChannelById(this.currentChannelId);
            if (tc != null) {
                tc.delete().reason("Cleaning up private guild after game ended").complete();
            } else {
                log.error("Did not find channel {} in private guild #{} to delete it.",
                        this.currentChannelId, this.privateGuildNumber);
            }
        } catch (final Exception e) {
            log.error("Exception while deleting channel {} in private guild #{} {}", this.currentChannelId,
                    this.privateGuildNumber, this.guildId, e);
            return;//leave the private guild in a "broken state", this can be later fixed manually through eval
        }
        this.inUse = false;
        Wolfia.AVAILABLE_PRIVATE_GUILD_QUEUE.add(this);
    }
}
项目:JDA    文件:InviteAction.java   
@Override
protected void handleResponse(final Response response, final Request<Invite> request)
{
    if (response.isOk())
        request.onSuccess(this.api.getEntityBuilder().createInvite(response.getObject()));
    else
        request.onFailure(response);
}