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


Java OnlineStatus.ONLINE属性代码示例

本文整理汇总了Java中net.dv8tion.jda.core.OnlineStatus.ONLINE属性的典型用法代码示例。如果您正苦于以下问题:Java OnlineStatus.ONLINE属性的具体用法?Java OnlineStatus.ONLINE怎么用?Java OnlineStatus.ONLINE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.dv8tion.jda.core.OnlineStatus的用法示例。


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

示例1: onExecute

/**
 * Called when command is executed.
 *
 * @param args Arguments provided by user.
 */
@Override
void onExecute(String[] args) {
    String opponentUsername = "";
    if (args.length > 0) {
        opponentUsername = args[0];
    }
    if (opponentUsername.isEmpty()) {
        getMessageChannel().sendMessage("Who do you want to play against?");
        opponentUsername = nextMessage().getContent().split(" ")[0];
    }
    this.opponent = getJda().getUsersByName(opponentUsername, true).get(0);
    if (opponent == null || getGuild().getMember(opponent).getOnlineStatus() != OnlineStatus.ONLINE) {
        getMessageChannel().sendMessage("This user isn't online, or doesn't exist.");
        return;
    }
    getMessageChannel().sendMessage("Starting Tic Tac Toe game!\n" +
            "Opposing " + getExecutor().getName() + "(X) and " + opponent.getName() + "(O) !\n" +
            "To play, enter the letter A B or C followed by 1 2 or 3 when it's your turn.");

    startGame();
}
 
开发者ID:iSach,项目名称:Samaritan,代码行数:26,代码来源:CommandTicTacToe.java

示例2: isOnline

public static boolean isOnline(Member member) {
    OnlineStatus status = member.getOnlineStatus();

    return (status == OnlineStatus.ONLINE) ||
           (status == OnlineStatus.DO_NOT_DISTURB) ||
           (status == OnlineStatus.IDLE);
}
 
开发者ID:Samoxive,项目名称:SafetyJim,代码行数:7,代码来源:DiscordUtils.java

示例3: UIStatusBar

public UIStatusBar(ImageIcon image) {
    setLayout(new BorderLayout());

    setBackground(Color.decode("#99AAB5"));

    icon = new JLabel(TransparentDiscord.resizeToWidth(image,25));

    //Create a list of valid statuses; the user should not set their status to offline or unknown
    OnlineStatus[] validStatuses = {OnlineStatus.ONLINE, OnlineStatus.IDLE, OnlineStatus.DO_NOT_DISTURB, OnlineStatus.INVISIBLE};

    status = new JComboBox<OnlineStatus>(validStatuses);
    newChat = new JLabel("Friends");

    icon.setBorder(new EmptyBorder(10,10,10,10));
    status.setBorder(new EmptyBorder(10,10,10,10));
    newChat.setBorder(new EmptyBorder(10,10,10,10));

    newChat.setForeground(Color.WHITE);
    status.setBackground(Color.decode("#99AAB5"));
    status.setForeground(Color.WHITE);

    status.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            TransparentDiscord.setStatus(status.getItemAt(status.getSelectedIndex()));
        }
    });

    newChat.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent mouseEvent) {
            TransparentDiscord.friendWindow.setVisible(true);
        }
    });

    newChat.setCursor(new Cursor(Cursor.HAND_CURSOR));

    add(icon, BorderLayout.WEST);
    add(status, BorderLayout.CENTER);
    add(newChat, BorderLayout.EAST);
}
 
开发者ID:MCPlummet,项目名称:TransparentDiscord,代码行数:41,代码来源:UIStatusBar.java

示例4: isPatronBotPresentAndOnline

public static boolean isPatronBotPresentAndOnline(Guild guild) {
    JDA jda = guild.getJDA();
    User other = jda.getUserById(BotConstants.PATRON_BOT_ID);
    return other != null && guild.getMember(other) != null && guild.getMember(other).getOnlineStatus() == OnlineStatus.ONLINE;
}
 
开发者ID:Frederikam,项目名称:GensokyoBot,代码行数:5,代码来源:DiscordUtil.java


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