当前位置: 首页>>代码示例>>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;未经允许,请勿转载。