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

项目:Ducky-Mc-Duckerson    文件:PreloadCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters,
                    Map<String, CommandStructure> commandList) {

    Long guildID = author.getGuild().getIdLong();

    try {
        boolean setDefault = dbMan.setNewPermissionNames(guildID);
        if (setDefault) {
            channel.sendMessage(localize(channel, "command.preload.success")).queue(); //
        }

    } catch (SQLException e) {
        e.printStackTrace();
    }

}
项目:happybot    文件:SpamCommand.java   
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.HELPER)) {
        if (e.getMessage().getMentionedUsers().size() == 1) {
            Member u = C.getMentionedMember(e);
            if (C.hasRole(u, Roles.EXP_SPAMMER)) {
                C.removeRole(u, Roles.EXP_SPAMMER);
                e.replySuccess(u.getUser().getAsMention() + " is no longer an EXP Spammer!");
            } else {
                C.giveRole(u, Roles.EXP_SPAMMER);
                e.replySuccess(u.getUser().getAsMention() + " has become an EXP Spammer!");
                C.privChannel(C.getMentionedMember(e), "You have become an EXP Spammer! Please ask to get this removed 1 week from now!");
            }
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.HELPER));
    }
}
项目:Saber-Bot    文件:ListCommand.java   
/**
 * produces the display style of the users who have rsvped for an event
 * @param mobileFlag (boolean) use mobile style?
 * @param IdFlag (boolean) use ID style?
 * @param member (Member) user to display
 * @return (String) display name of the user
 */
private String getNameDisplay(boolean mobileFlag, boolean IdFlag, Member member)
{
    String display;
    if(mobileFlag)
    {
        display = member.getEffectiveName() + "\n";
    }
    else if(IdFlag)
    {
        display = " \\<@" + member.getUser().getId() + ">\n";
    }
    else
    {
        display = " <@" + member.getUser().getId() + ">\n";
    }
    return display;
}
项目:krobot    文件:UserUtils.java   
/**
 * Resolve a user from a String.<br>
 * The guild is used to check if it is a nickname and not the
 * user real name.<br><br>
 *
 * Example : "@Litarvan", "Litarvan", or "87279950075293696"<br>
 * returns the JDA User object of Litarvan.
 *
 * @param guild The guild where the user is
 * @param user A string (mention/username/id) of the user
 *             to resolve
 *
 * @return The resolved user or null if none was found
 */
@Nullable
public static User resolve(@NotNull Guild guild, @NotNull String user)
{
    user = user.trim();
    List<Member> users = guild.getMembersByNickname(user, true);

    if (users.size() == 0 && user.startsWith("@"))
    {
        users = guild.getMembersByNickname(user.substring(1), true);
    }

    if (users.size() == 0)
    {
        return resolve(user);
    }

    return users.get(0).getUser();
}
项目:BullyBot    文件:CmdAddAdmin.java   
@Override
public void execCommand(Server server, Member member, String[] args) {
    String pName;
    try{
        if(args.length == 1){
            Member m = server.getMember(args[0]);
            if (m != null){
                pName = m.getEffectiveName();
                server.addAdmin(m.getUser().getId());
            }else{
                throw new DoesNotExistException("User");
            }
        }else{
            throw new BadArgumentsException();
        }
        this.response = Utils.createMessage(String.format("`%s is now an admin`", pName));
        System.out.println(success());
    }catch(BadArgumentsException | DoesNotExistException | InvalidUseException ex){
        this.response = Utils.createMessage("Error!", ex.getMessage(), false);
    }
}
项目:BullyBot    文件:CmdSubCaptain.java   
@Override
public void execCommand(Server server, Member member, String[] args) {
    try{
        if(args.length == 1){
            Member target = server.getMember(args[0]);

            if(target != null){
                server.getQueueManager().subCaptain(member.getUser(), target.getUser());
            }else{
                throw new DoesNotExistException(args[0]);
            }
        }else{
            throw new BadArgumentsException();
        }
        this.response = Utils.createMessage(String.format("`%s is now a captain`", member.getEffectiveName()));
        System.out.println(success());
    }catch(BadArgumentsException | InvalidUseException | DoesNotExistException ex){
        this.response = Utils.createMessage("Error!", ex.getMessage(), false);
    }
}
项目:Rubicon    文件:CommandKick.java   
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
    Message msg = parsedCommandInvocation.getMessage();
    if (msg.getMentionedUsers().isEmpty()) {
        return new MessageBuilder().setEmbed(EmbedUtil.info("Usage", "kick <@User>").build()).build();
    }
    Member target = msg.getGuild().getMember(msg.getMentionedUsers().get(0));
    if (!msg.getGuild().getSelfMember().canInteract(target)) {
        return new MessageBuilder().setEmbed(EmbedUtil.error("No permissions", "Sorry I can't kick this User!!!").build()).build();
    } else {
        PrivateChannel channel = target.getUser().openPrivateChannel().complete();
        channel.sendMessage(EmbedUtil.success("Kicked", "You got kicked").build()).queue();
        msg.getGuild().getController().kick(target).queue();


        return new MessageBuilder().setEmbed(EmbedUtil.success("Kicked", "Succesfully kicked " + target.getAsMention()).build()).build();
    }
}
项目:Rubicon    文件:CommandUnmute.java   
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
    Message message = parsedCommandInvocation.getMessage();
    if (message.getMentionedUsers().isEmpty())
        return new MessageBuilder().setEmbed(EmbedUtil.info("Usage", "unmute <@User>").build()).build();
    Member target = message.getGuild().getMember(message.getMentionedUsers().get(0));
    if (!message.getGuild().getSelfMember().canInteract(target))
        return new MessageBuilder().setEmbed(EmbedUtil.error("No permission", "Sorry i can't unmute this use! It's a moderator or higher").build()).build();

    TextChannel channel = message.getTextChannel();
    if (channel.getPermissionOverride(target) == null)
        channel.createPermissionOverride(target).complete();
    if (!channel.getPermissionOverride(target).getDenied().contains(Permission.MESSAGE_WRITE))
        return new MessageBuilder().setEmbed(EmbedUtil.error("Not muted", "This user is no muted. Use `mute <@User>` to mute him").build()).build();
    message.getGuild().getTextChannels().forEach(c -> {
        if (c.getPermissionOverride(target) == null)
            c.createPermissionOverride(target).complete();
        c.getPermissionOverride(target).getManager().grant(Permission.MESSAGE_WRITE).queue();
    });
    PrivateChannel targetch = target.getUser().openPrivateChannel().complete();
    targetch.sendMessage(EmbedUtil.info("Unmuted", "You got unmuted on `" + message.getGuild().getName() + "` by " + message.getAuthor().getAsMention()).build()).queue();
    return new MessageBuilder().setEmbed(EmbedUtil.success("Unmuted", "Successfully Unmuted " + target.getAsMention()).build()).build();

}
项目:Rubicon    文件:CommandMute.java   
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
    Message message = parsedCommandInvocation.getMessage();
    if (message.getMentionedUsers().isEmpty())
        return new MessageBuilder().setEmbed(EmbedUtil.info("Usage", "mute <@User>").build()).build();
    Member target = message.getGuild().getMember(message.getMentionedUsers().get(0));
    if (!message.getGuild().getSelfMember().canInteract(target))
        return new MessageBuilder().setEmbed(EmbedUtil.error("No permission", "Sorry i can't mute this user! His/her role is higher than yours.").build()).build();

    TextChannel channel = message.getTextChannel();
    if (channel.getPermissionOverride(target) == null)
        channel.createPermissionOverride(target).complete();
    if (channel.getPermissionOverride(target).getDenied().contains(Permission.MESSAGE_WRITE))
        return new MessageBuilder().setEmbed(EmbedUtil.error("Already muted", "This user is already muted.").build()).build();
    message.getGuild().getTextChannels().forEach(c -> {
        if (c.getPermissionOverride(target) == null)
            c.createPermissionOverride(target).complete();
        c.getPermissionOverride(target).getManager().deny(Permission.MESSAGE_WRITE).queue();
    });
    PrivateChannel targetch = target.getUser().openPrivateChannel().complete();
    targetch.sendMessage(EmbedUtil.info("Muted", "You got muted on `" + message.getGuild().getName() + "` by " + message.getAuthor().getAsMention()).build()).queue();
    return new MessageBuilder().setEmbed(EmbedUtil.success("Muted", "Successfully muted " + target.getAsMention()).build()).build();
}
项目:Rubicon    文件:CommandBan.java   
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
    Message msg = parsedCommandInvocation.getMessage();
    if (msg.getMentionedUsers().isEmpty()) {
        return new MessageBuilder().setEmbed(EmbedUtil.info("Usage", "ban <@User>").build()).build();
    }
    Member target = msg.getGuild().getMember(msg.getMentionedUsers().get(0));
    if (!msg.getGuild().getSelfMember().canInteract(target)) {
        return new MessageBuilder().setEmbed(EmbedUtil.error("No permissions", "Sorry I can't ban this User.").build()).build();
    } else {
        if (!target.getUser().isBot()) {
            PrivateChannel channel = target.getUser().openPrivateChannel().complete();
            channel.sendMessage(EmbedUtil.success("Banned", "You got banned").build()).queue();
        }
        msg.getGuild().getController().ban(target, 7).queue();
        return new MessageBuilder().setEmbed(EmbedUtil.success("Banned", "Successfully banned " + target.getAsMention()).build()).build();
    }
}
项目:happybot    文件:OgCommand.java   
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.ADMIN)) {
        if (e.getMessage().getMentionedUsers().size() == 1) {
            Member u = C.getMentionedMember(e);
            if (C.hasRole(u, Roles.OG)) {
                C.removeRole(u, Roles.OG);
                e.replySuccess(u.getUser().getAsMention() + " is no OG!");
            } else {
                C.giveRole(u, Roles.OG);
                e.replySuccess(u.getUser().getAsMention() + " has become OG!");
            }
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.ADMIN));
    }
}
项目:MDC-Discord-Bot    文件:MuteHandler.java   
/**
 * Check through muted members and unmute any which have passed their unmute time
 */
private static void checkMutedMembers()
{
    long currentTime = System.currentTimeMillis();
    for(Map.Entry<User, Long> timeEntry : unmuteTimes.entrySet())
    {
        if(timeEntry.getValue() <= currentTime)
        {
            User user = timeEntry.getKey();
            for(Guild guild : user.getMutualGuilds())
            {
                Member member = guild.getMember(user);
                if(member != null)
                {
                    unmuteMember(member);
                    Util.logChannel(LogLevel.INFO, "%s has been auto-unmuted", member.getEffectiveName());
                    Util.info(MuteHandler.class, "%s has been auto-unmuted", member.getEffectiveName());
                }
            }
        }
    }
}
项目:happybot    文件:BanCommand.java   
@Override
protected void execute(CommandEvent e) {
    if (C.hasRole(e.getMember(), Roles.MODERATOR)) {
        if (C.containsMention(e)) {
            if (e.getArgs().replaceAll("<(.*?)>", "").isEmpty()) {
                e.replyError("**Correct Usage:** ^" + name + " " + arguments);
                return;
            }
            String reason = e.getArgs().replaceFirst("<(.*?)> ", "");
            Member target = C.getMentionedMember(e);
            C.getCtrl(e).ban(target.getUser(), 7, "Banned by Moderator: " + e.getMember().getUser().getName()).reason("Banned by Moderator: " + e.getMember().getUser().getName() + ". With Reason: " + reason).queue();
            e.replySuccess("User " + target.getUser().getName() + "#" + target.getUser().getDiscriminator() + " has been **FRIGGING BANNED** by " + e.getMember().getEffectiveName());
        } else {
            e.replyError("**Correct Usage:** ^" + name + " " + arguments);
        }
    } else {
        e.replyError(C.permMsg(Roles.MODERATOR));
    }
}
项目:Ducky-Mc-Duckerson    文件:PlayerList.java   
/**
 * Add player player.
 *
 * @param user the user
 * @return the player
 */
public Player addPlayer(Member user) {
    Player player = new Player(user, playerCount);
    //Get Player ID
    //player.setId(db.sql_getPlayerID(name, hostname));
    playerList.put(player.getUserID(), player);
    playerCount++;
    return player;

}
项目:Ducky-Mc-Duckerson    文件:PlayerList.java   
/**
 * Gets player member.
 *
 * @param playerID the player id
 * @return player member
 */
public Member getPlayerMember(Long playerID) {
    if (playerList.containsKey(playerID)) {
        return playerList.get(playerID).getMember();
    }

    return null;
}
项目:Ducky-Mc-Duckerson    文件:PlayerList.java   
public List<Member> getMemberList() {
    Map<Long, Player> removeNoLynch = new HashMap<Long, Player>(playerList);
    removeNoLynch.remove((long) 0);

    List<Member> playerNames = new ArrayList<Member>();

    for (Player player : removeNoLynch.values()) {
        playerNames.add(player.getMember());
    }
    return playerNames;
}
项目:Ducky-Mc-Duckerson    文件:Player.java   
/**
 * Instantiates a new Player.
 *
 * @param player   the player
 * @param playerNo the player no
 */
public Player(Member player, int playerNo) {
    setPlayer(player);
    setPlayerNo(playerNo);
    setRole(Role.NOROLE);
    setPlayerState(PlayerState.ALIVE);
    setNonVoteCount(0);
}
项目:Ducky-Mc-Duckerson    文件:FetchCalendarCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {

    if (hasPermission(author)) {
        HTMLParse.get_instance().GetTodayCalendarData(channel);
    }
}
项目:Ducky-Mc-Duckerson    文件:TableFlipCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {
    Long guildID = author.getGuild().getIdLong();
    if (hasPermission(author)) {
        channel.sendMessage(author.getEffectiveName() + ": (╯°□°)╯︵ ┻━┻").queue();
        try {
            dbMan.incUserFlipped(guildID, author.getUser().getIdLong());
        } catch (SQLException e) {
            channel.sendMessage(localize(channel, "command.tableflip.error.sql")).queue();
        }
    }
}
项目:GensokyoBot    文件:StatsCommand.java   
@Override
public void onInvoke(Guild guild, TextChannel channel, Member invoker, Message message, String[] args) {
    long totalSecs = (System.currentTimeMillis() - FredBoat.START_TIME) / 1000;
    int days = (int) (totalSecs / (60 * 60 * 24));
    int hours = (int) ((totalSecs / (60 * 60)) % 24);
    int mins = (int) ((totalSecs / 60) % 60);
    int secs = (int) (totalSecs % 60);

    String str = MessageFormat.format(
            I18n.get(guild).getString("statsParagraph"),
            days, hours, mins, secs, CommandManager.commandsExecuted - 1)
            + "\n";

    str = MessageFormat.format(I18n.get(guild).getString("statsRate"), str, (float) (CommandManager.commandsExecuted - 1) / ((float) totalSecs / (float) (60 * 60)));

    str = str + "\n\n```";

    str = str + "Reserved memory:                " + Runtime.getRuntime().totalMemory() / 1000000 + "MB\n";
    str = str + "-> Of which is used:            " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1000000 + "MB\n";
    str = str + "-> Of which is free:            " + Runtime.getRuntime().freeMemory() / 1000000 + "MB\n";
    str = str + "Max reservable:                 " + Runtime.getRuntime().maxMemory() / 1000000 + "MB\n";

    str = str + "\n----------\n\n";

    str = str + "Sharding:                       " + FredBoat.getInstance(guild.getJDA()).getShardInfo().getShardString() + "\n";
    str = str + "Players playing:                " + PlayerRegistry.getPlayingPlayers().size() + "\n";

    str = str + "Known servers:                  " + FredBoat.getAllGuilds().size() + "\n";
    str = str + "Known users in servers:         " + FredBoat.getAllUsersAsMap().size() + "\n";
    str = str + "Distribution:                   " + Config.CONFIG.getDistribution() + "\n";
    str = str + "JDA responses total:            " + guild.getJDA().getResponseTotal() + "\n";
    str = str + "JDA version:                    " + JDAInfo.VERSION;

    str = str + "```";

    channel.sendMessage(TextUtils.prefaceWithName(invoker, str)).queue();
}
项目:Ducky-Mc-Duckerson    文件:StartCalendarCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {

    if (hasPermission(author)) {
        HTMLParse.get_instance().CalenderStart(channel);
    }
}
项目:Ducky-Mc-Duckerson    文件:UnflipCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {
    Long guildID = author.getGuild().getIdLong();
    if (hasPermission(author)) {
        channel.sendMessage(author.getEffectiveName() + ": ┬─┬\uFEFF ノ( ゜-゜ノ)").queue();
        try {
            dbMan.incUserUnflipped(guildID, author.getUser().getIdLong());
        } catch (SQLException e) {
            channel.sendMessage(localize(channel, "command.unflip.error.sql")).queue();
        }
    }
}
项目:Ducky-Mc-Duckerson    文件:SetCommandLevelCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {
    Long guildID = author.getGuild().getIdLong();

    if (hasPermission(author)) {
        if (parameters.isEmpty()) {
            channel.sendMessage(localize(channel, "command.set_command_level.error.command_missing", dbMan.getPrefix(guildID) + commandName)).queue();
        }
        String[] paraList = parameters.split(" ");
        String cmdID = paraList[1];
        if (isInteger(paraList[2])) {
            Integer commandLevel = Integer.valueOf(paraList[2]);
            //TODO Check people's userlevel to make sure they can't assign a value higher than what they have.
            if (commandList.containsKey(cmdID)) {
                try {
                    dbMan.setCommandLevel(guildID, commandList.get(cmdID).commandID, commandLevel);
                    channel.sendMessage(localize(channel, "command.set_command_level.success", dbMan.getLevelName(guildID, commandLevel), cmdID)).queue();
                } catch (SQLException e) {
                    e.printStackTrace();
                    channel.sendMessage(localize(channel, "command.set_command_level.error.sql")).queue();
                }
            } else {

            }
        } else {
            channel.sendMessage(localize(channel, "command.set_command_level.error.syntax", dbMan.getPrefix(guildID) + commandName)).queue();
        }
    }

}
项目:JuniperBotJ    文件:PlayerServiceImpl.java   
@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)) {
        throw new DiscordException("discord.global.voice.noAccess");
    }
    instance.openAudioConnection(channel);
    return channel;
}
项目:Ducky-Mc-Duckerson    文件:AliasMappingCS.java   
@Override
public void execute(Member author, User authorUser, MessageChannel channel, Message message, String parameters, Map<String, CommandStructure> commandList) {
  Long guildID = author.getGuild().getIdLong();
  CommandStructure command = commandMapping.get(guildID);
  if (command != null) {
      command.execute(author, authorUser, channel, message, parameters, commandList);
  }
}
项目:GensokyoBot    文件:InviteCommand.java   
@Override
public void onInvoke(Guild guild, TextChannel channel, Member invoker, Message message, String[] args)  {
    try {
        String str = "https://discordapp.com/oauth2/authorize?&client_id=" + DiscordUtil.getApplicationInfo(invoker.getJDA().getToken().substring(4)).getString("id") + "&scope=bot";
        String send = MessageFormat.format(I18n.get(guild).getString("invite"),DiscordUtil.getApplicationInfo(message.getJDA().getToken().substring(4)).getString("name"));
        channel.sendMessage(send + "\n" + str).queue();
    } catch (UnirestException e) {
        throw new RuntimeException(e);
    }
}
项目:BullyBot    文件:CmdRestart.java   
@Override
public void execCommand(Server server, Member member, String[] args) {
    ServerManager.removeServer(server.getGuild());
    ServerManager.addNewServer(server.getGuild());
    this.response = Utils.createMessage("`Server instance restarted`");
    System.out.println(success());
}
项目:momo-2    文件:UserInfo.java   
@Override
public void executeCommand(Message msg) {
    EmbedBuilder em = new EmbedBuilder();
    String contents = Util.getCommandContents(msg);
    Member target;
    if(contents.isEmpty())
        target = msg.getGuild().getMember(msg.getAuthor());
    else if((target = Util.resolveMemberFromMessage(msg)) == null) {
        em.setTitle("Error", null)
        .setColor(Color.RED)
        .setDescription("No user found for " + contents);
        msg.getChannel().sendMessage(em.build()).queue();
        return;
    }

    AtomicInteger mutualServers = new AtomicInteger();
    Bot.getInstance().getBots().stream()
    .forEach(j -> {
        mutualServers.addAndGet((int) j.getGuilds().stream()
        .filter(g -> g.getMemberById(target.getUser().getId()) != null)
        .count());
    });
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");
    em.setTitle("User info for " + target.getEffectiveName(), null)
    .setColor(Util.resolveColor(Util.memberFromMessage(msg), Color.MAGENTA))
    .addField("User", target.getUser().getName() + "#" + target.getUser().getDiscriminator(), true)
    .addField("Creation date", target.getUser().getCreationTime().format(formatter), true)
    .addField("Mutual servers", mutualServers + "", true)
    .addField("Server join date", target.getJoinDate().format(formatter), true)
    .addField("Roles", "`" + target.getRoles().stream()
            .map(Role::getName)
            .collect(Collectors.joining(", ")) + "`", true)
    .setThumbnail(target.getUser().getAvatarUrl());
    msg.getChannel().sendMessage(em.build()).queue();
}
项目:WeenieBot    文件:WeenieBot.java   
private VoiceChannel getVoiceChannel(User user, Guild guild)
{
    for (VoiceChannel v : guild.getVoiceChannels())
    {
        for (Member m : v.getMembers())
        {
            if (m.getUser().getId().equalsIgnoreCase(user.getId()))
            {
                return v;
            }
        }
    }

    return null;
}
项目:momo-2    文件:GuildMusicManager.java   
public static void loadGuildPlaylist(TextChannel channel, Member member) {
    GuildObject g = GuildObject.guildMap.get(channel.getGuild().getId());
    for (PlaylistEntity p : g.getMusicPlaylist()) {
        loadAndPlay(channel, p.getUrl(), null, member, false);
    }
    EmbedBuilder em = new EmbedBuilder();
    em.setTitle("Success", null)
    .setColor(Util.resolveColor(member, Color.GREEN))
    .setDescription("Queued up your playlist!");
    channel.sendMessage(em.build()).queue();
}
项目:Ducky-Mc-Duckerson    文件:TesterTitleItem.java   
@Override
public void executeUse(Guild guild, Member member, MessageChannel channel) {
    Long guildID = guild.getIdLong();
    Long userID = member.getUser().getIdLong();
    try {
        // TODO: localize title?
        dbMan.setUserTitle(guildID, userID, this.getName());
        channel.sendMessage(localize(channel, "item.tester_title.title_set", this.getLocalizedName(channel))).queue();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
项目:GensokyoBot    文件:LeaveCommand.java   
@Override
public void onInvoke(Guild guild, TextChannel channel, Member invoker, Message message, String[] args) {
    try {
        GuildPlayer player = PlayerRegistry.get(guild);
        player.setCurrentTC(channel);
        player.leaveVoiceChannelRequest(channel, false);
    } catch (Exception e) {
        log.error("Something caused us to not properly leave a voice channel!", e);
        guild.getAudioManager().closeAudioConnection();
    }
}
项目:BeamTeamDiscordBot    文件:JDAManager.java   
public static void removeTeamRoleFromUser(BTBRole role, User user) {
    Guild guild = getJDA().getGuildById(Long.toString(role.getGuildID()));
    Member member = guild.getMember(user);

    if (null != member) {
        guild.getController().removeRolesFromMember(member, guild.getRoleById(role.getRoleID())).queue();
    }
}
项目:Supreme-Bot    文件:AdvancedMember.java   
public final AdvancedMember setMember(Member member) {
    if (member == null) {
        this.user = null;
    } else {
        this.user = member.getUser();
    }
    this.member = member;
    return this;
}
项目:Supreme-Bot    文件:AdvancedMember.java   
public static final AdvancedMember ofMember(Member member) {
    final AdvancedMember temp = getObjects(AdvancedMember.class).stream().filter((advancedMember) -> {
        return advancedMember.member == member;
    }).findFirst().orElse(null);
    if (temp != null) {
        return temp;
    }
    return new AdvancedMember(member);
}
项目:JuniperBotJ    文件:ContextServiceImpl.java   
@Override
public void initContext(Event event) {
    Member member = resolverService.getMember(event);
    if (member != null) {
        initContext(member);
    }
    User user = resolverService.getUser(event);
    if (user != null) {
        initContext(user);
    }
    Guild guild = resolverService.getGuild(event);
    if (guild != null) {
        initContext(guild);
    }
}
项目:momo-2    文件:TrackDetails.java   
public TrackDetails(String url, String title, Member queuer, AudioTrack track, String guildId) {
    this.url = url;
    this.title = title;
    this.queuer = queuer;
    this.track = track;
    this.guildId = guildId;
}
项目:MDC-Discord-Bot    文件:CommandAnnounce.java   
@Override
protected void doCommand(CommandEvent event)
{
    Member member = event.getMember();
    if(member != null && !event.getArgs().isEmpty())
    {
        EmbedBuilder builder = new EmbedBuilder();
        builder.setAuthor(Util.getFullUser(member.getUser()), null, member.getUser().getEffectiveAvatarUrl());
        builder.setTitle("Announcement");
        builder.setDescription(event.getArgs());
        builder.setColor(member.getColor());
        reply(event, builder.build());
    }
}
项目:JuniperBotJ    文件:RemindCommand.java   
private void createReminder(MessageChannel channel, Member member, String message, Date date) {
    JobDetail job = ReminderJob.createDetails(channel, member, message);
    Trigger trigger = TriggerBuilder
            .newTrigger()
            .startAt(date)
            .withSchedule(SimpleScheduleBuilder.simpleSchedule())
            .build();
    try {
        schedulerFactoryBean.getScheduler().scheduleJob(job, trigger);
    } catch (SchedulerException e) {
        throw new RuntimeException(e);
    }
}
项目:GensokyoBot    文件:ArgumentUtil.java   
public static List<Member> fuzzyMemberSearch(Guild guild, String term) {
    ArrayList<Member> list = new ArrayList<>();

    term = term.toLowerCase();

    for(Member mem : guild.getMembers()) {
        if((mem.getUser().getName().toLowerCase() + "#" + mem.getUser().getDiscriminator()).contains(term)
                | (mem.getEffectiveName().toLowerCase().contains(term))
                | term.contains(mem.getUser().getId())) {
            list.add(mem);
        }
    }

    return list;
}