当前位置: 首页>>代码示例>>Java>>正文


Java Member类代码示例

本文整理汇总了Java中net.dv8tion.jda.core.entities.Member的典型用法代码示例。如果您正苦于以下问题:Java Member类的具体用法?Java Member怎么用?Java Member使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Member类属于net.dv8tion.jda.core.entities包,在下文中一共展示了Member类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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();
    }

}
 
开发者ID:IANetworks,项目名称:Ducky-Mc-Duckerson,代码行数:18,代码来源:PreloadCS.java

示例2: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:21,代码来源:SpamCommand.java

示例3: getNameDisplay

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:notem,项目名称:Saber-Bot,代码行数:25,代码来源:ListCommand.java

示例4: resolve

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:krobot-framework,项目名称:krobot,代码行数:33,代码来源:UserUtils.java

示例5: execCommand

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:Implosions,项目名称:BullyBot,代码行数:22,代码来源:CmdAddAdmin.java

示例6: execCommand

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:Implosions,项目名称:BullyBot,代码行数:21,代码来源:CmdSubCaptain.java

示例7: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:19,代码来源:CommandKick.java

示例8: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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();

}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:25,代码来源:CommandUnmute.java

示例9: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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();
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:24,代码来源:CommandMute.java

示例10: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:Rubicon-Bot,项目名称:Rubicon,代码行数:19,代码来源:CommandBan.java

示例11: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:20,代码来源:OgCommand.java

示例12: checkMutedMembers

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
/**
 * 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());
                }
            }
        }
    }
}
 
开发者ID:thebrightspark,项目名称:MDC-Discord-Bot,代码行数:25,代码来源:MuteHandler.java

示例13: execute

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
@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));
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:20,代码来源:BanCommand.java

示例14: addPlayer

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
/**
 * 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;

}
 
开发者ID:IANetworks,项目名称:Ducky-Mc-Duckerson,代码行数:16,代码来源:PlayerList.java

示例15: getPlayerMember

import net.dv8tion.jda.core.entities.Member; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:IANetworks,项目名称:Ducky-Mc-Duckerson,代码行数:14,代码来源:PlayerList.java


注:本文中的net.dv8tion.jda.core.entities.Member类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。