本文整理汇总了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();
}
示例2: isOnline
public static boolean isOnline(Member member) {
OnlineStatus status = member.getOnlineStatus();
return (status == OnlineStatus.ONLINE) ||
(status == OnlineStatus.DO_NOT_DISTURB) ||
(status == OnlineStatus.IDLE);
}
示例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);
}
示例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;
}