當前位置: 首頁>>代碼示例>>Java>>正文


Java AccountManager類代碼示例

本文整理匯總了Java中net.dv8tion.jda.core.managers.AccountManager的典型用法代碼示例。如果您正苦於以下問題:Java AccountManager類的具體用法?Java AccountManager怎麽用?Java AccountManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AccountManager類屬於net.dv8tion.jda.core.managers包,在下文中一共展示了AccountManager類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setNickname

import net.dv8tion.jda.core.managers.AccountManager; //導入依賴的package包/類
public static final boolean setNickname(String nickname) {
    if (nickname == null || nickname.isEmpty()) {
        return false;
    }
    Config.CONFIG.setBotNickname(nickname);
    try {
        final JDA jda = getJDA();
        if (jda != null) {
            final SelfUser user = jda.getSelfUser();
            if (user != null) {
                if (!nickname.equals(user.getName())) {
                    final AccountManager manager = user.getManager();
                    if (manager != null) {
                        manager.setName(nickname).queue();
                        System.out.println("Changed nickname to \"" + nickname + "\".");
                        return true;
                    } else {
                        System.err.println("Failed to change nickname to \"" + nickname + "\": AccountManager is null!");
                    }
                } else {
                    //System.err.println("Failed to change nickname to \"" + nickname + "\": Nickname is already set!");
                }
            } else {
                System.err.println("Failed to change nickname to \"" + nickname + "\": SelfUser is null!");
            }
        } else {
            System.err.println("Failed to change nickname to \"" + nickname + "\": JDA is null!");
        }
        return false;
    } catch (Exception ex) {
        System.err.println("Failed to change nickname to \"" + nickname + "\"");
        //ex.printStackTrace();
        return false;
    }
}
 
開發者ID:Panzer1119,項目名稱:Supreme-Bot,代碼行數:36,代碼來源:Standard.java

示例2: getManager

import net.dv8tion.jda.core.managers.AccountManager; //導入依賴的package包/類
@Override
public AccountManager getManager()
{
    AccountManager mng = manager;
    if (mng == null)
    {
        synchronized (mngLock)
        {
            mng = manager;
            if (mng == null)
                mng = manager = new AccountManager(this);
        }
    }
    return mng;
}
 
開發者ID:DV8FromTheWorld,項目名稱:JDA,代碼行數:16,代碼來源:SelfUserImpl.java

示例3: getManager

import net.dv8tion.jda.core.managers.AccountManager; //導入依賴的package包/類
/**
 * The {@link net.dv8tion.jda.core.managers.AccountManager AccountManager}
 * for the currently logged in account.
 *
 * <p>This can be used to atomically set account fields (like avatar/username)
 *
 * @return An AccountManager instance for the current account
 */
AccountManager getManager();
 
開發者ID:DV8FromTheWorld,項目名稱:JDA,代碼行數:10,代碼來源:SelfUser.java


注:本文中的net.dv8tion.jda.core.managers.AccountManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。