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


Java ClientBuilder.withToken方法代码示例

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


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

示例1: run

import sx.blah.discord.api.ClientBuilder; //导入方法依赖的package包/类
@Override
public void run(String... arg0) throws Exception
{   
    IDiscordClient client;
    ClientBuilder clientBuilder = new ClientBuilder();
    clientBuilder.withToken(token);

    try
    {
        client = clientBuilder.login();
        
        EventDispatcher dispatcher = client.getDispatcher();
        dispatcher.registerListener(new LeaderboardDiscordActions(client, prefix, leaderboardDao, leaderboardColumnDao));
    }
    catch (DiscordException e)
    {
        e.printStackTrace();
        System.exit(0);
    }
}
 
开发者ID:Vyserion,项目名称:lodbot,代码行数:21,代码来源:Bot.java

示例2: createClient

import sx.blah.discord.api.ClientBuilder; //导入方法依赖的package包/类
public static IDiscordClient createClient(String token, boolean login) { // Returns a new instance of the Discord client
    ClientBuilder clientBuilder = new ClientBuilder(); // Creates the ClientBuilder instance
    clientBuilder.withToken(token); // Adds the login info to the builder
    try {
        if (login) {
            return clientBuilder.login(); // Creates the client instance and logs the client in
        } else {
            return clientBuilder.build(); // Creates the client instance but it doesn't log the client in yet, you would have to call client.login() yourself
        }
    } catch (DiscordException e) { // This is thrown if there was a problem building the client
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:ate47,项目名称:ATEBot,代码行数:15,代码来源:Main.java

示例3: createClient

import sx.blah.discord.api.ClientBuilder; //导入方法依赖的package包/类
private static IDiscordClient createClient(String token, boolean login) {
    ClientBuilder clientBuilder = new ClientBuilder();
    clientBuilder.withToken(token);

    try {
        if (login) {
            return clientBuilder.login();
        } else {
            return clientBuilder.build();
        }
    } catch (DiscordException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:HaaseIT,项目名称:7DtDisco,代码行数:16,代码来源:Main.java

示例4: newClientBuilder

import sx.blah.discord.api.ClientBuilder; //导入方法依赖的package包/类
private ClientBuilder newClientBuilder() {
    LeagueProperties.Discord discord = properties.getDiscord();
    ClientBuilder builder = new ClientBuilder()
        .withPingTimeout(discord.getMaxMissedPings())
        .setMaxReconnectAttempts(discord.getMaxReconnects());
    if (discord.getToken() != null) {
        return builder.withToken(discord.getToken());
    } else {
        throw new IllegalArgumentException("Must configure a bot token");
    }
}
 
开发者ID:quanticc,项目名称:ugc-bot-redux,代码行数:12,代码来源:DiscordService.java

示例5: getClientBuilder

import sx.blah.discord.api.ClientBuilder; //导入方法依赖的package包/类
public static ClientBuilder getClientBuilder(String token) throws DiscordException {
	ClientBuilder clientBuilder = new ClientBuilder();
	clientBuilder.withToken(token);
	clientBuilder.setMaxReconnectAttempts(64);
	clientBuilder.setDaemon(false);

	return clientBuilder;
}
 
开发者ID:chrislo27,项目名称:Baristron,代码行数:9,代码来源:Main.java

示例6: discordClient

import sx.blah.discord.api.ClientBuilder; //导入方法依赖的package包/类
@Bean
public static IDiscordClient discordClient(@Value("${bot.discord.token}") String token) throws DiscordException {
    ClientBuilder builder = new ClientBuilder();
    builder.withToken(token);
    return builder.build();
}
 
开发者ID:AnomalyXII,项目名称:werewolv.es-tools,代码行数:7,代码来源:BotConfiguration.java


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