本文整理汇总了Java中net.dv8tion.jda.core.requests.SessionReconnectQueue类的典型用法代码示例。如果您正苦于以下问题:Java SessionReconnectQueue类的具体用法?Java SessionReconnectQueue怎么用?Java SessionReconnectQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionReconnectQueue类属于net.dv8tion.jda.core.requests包,在下文中一共展示了SessionReconnectQueue类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: login
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
@Override
public void login(String token, ShardInfo shardInfo, SessionReconnectQueue reconnectQueue) throws LoginException, RateLimitedException {
setStatus(Status.LOGGING_IN);
if(token == null || token.isEmpty()) throw new LoginException("Provided token was null or empty!");
setToken(token);
verifyToken();
this.shardInfo = shardInfo;
JDAImpl.LOG.info("Login Successful!");
client = new ClientWebSocketClient(this, reconnectQueue, gatewayClient);
client.send(new JSONObject()
.put("d", presence.getFullPresence())
.put("op", WebSocketCode.PRESENCE).toString());
if(shutdownHook != null) {
Runtime.getRuntime().addShutdownHook(shutdownHook);
}
}
开发者ID:natanbc,项目名称:discord-bot-gateway,代码行数:20,代码来源:ClientJDA.java
示例2: ClientWebSocketClient
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
public ClientWebSocketClient(JDAImpl api, SessionReconnectQueue reconnectQueue, GatewayClient gatewayClient) {
super(api, reconnectQueue);
this.gatewayClient = gatewayClient;
try {
gatewayClient.register(this);
} catch(IOException e) {
throw new UncheckedIOException(e);
}
ratelimitThread.interrupt();
setupSendThread();
}
开发者ID:natanbc,项目名称:discord-bot-gateway,代码行数:12,代码来源:ClientWebSocketClient.java
示例3: login
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
@Override
public void login(String token, ShardInfo shardInfo, SessionReconnectQueue reconnectQueue) throws LoginException, RateLimitedException {
setStatus(Status.LOGGING_IN);
if(token == null || token.isEmpty()) throw new LoginException("Provided token was null or empty!");
setToken(token);
verifyToken();
this.shardInfo = shardInfo;
JDAImpl.LOG.info("Login Successful!");
client = new ServerWebSocketClient(this, reconnectQueue, gatewayServer);
JSONObject cachedPresence = gatewayServer.cachedPresence;
if(cachedPresence != null) {
JSONObject game = cachedPresence.optJSONObject("game");
if(game != null) {
getPresence().setPresence(
OnlineStatus.fromKey(cachedPresence.getString("status")),
Game.of(game.getString("name"), game.optString("url")),
cachedPresence.getBoolean("afk")
);
} else {
getPresence().setPresence(
OnlineStatus.fromKey(cachedPresence.getString("status")),
null,
cachedPresence.getBoolean("afk")
);
}
gatewayServer.cachedPresence = null;
}
if(shutdownHook != null) {
Runtime.getRuntime().addShutdownHook(shutdownHook);
}
}
开发者ID:natanbc,项目名称:discord-bot-gateway,代码行数:36,代码来源:ServerJDA.java
示例4: main
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
public static void main(String[] args) throws LoginException, RateLimitedException {
new JDABuilder(AccountType.BOT)
.addEventListener(new EvalCommand()) // Register the author-exclusive eval command
.addEventListener(new MusicCommand()) // Register all music related subcommands
.setToken(Info.TOKEN) // Set the Authentication Token
.setBulkDeleteSplittingEnabled(false) // Performance reasons
.setEventManager(new ThreadedEventManager()) // Allow for simultaneous command processing
.setReconnectQueue(new SessionReconnectQueue()) // Let JDA handle reconnects
.buildAsync(); // Finally establish a connection to Discord's servers!
}
开发者ID:DinosParkour,项目名称:deeJay,代码行数:11,代码来源:Bot.java
示例5: ServerWebSocketClient
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
public ServerWebSocketClient(JDAImpl api, SessionReconnectQueue reconnectQueue, GatewayServer gatewayServer) {
super(api, reconnectQueue);
this.gatewayServer = gatewayServer;
gatewayServer.register(this);
}
开发者ID:natanbc,项目名称:discord-bot-gateway,代码行数:6,代码来源:ServerWebSocketClient.java
示例6: main
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
public static void main(String[] args) throws LoginException, InterruptedException, RateLimitedException {
String token = GSONUtils.getConfig().getToken();
if (GSONUtils.getConfig().getDcoinToken() != null) {
discoin = new Discoin4J(GSONUtils.getConfig().getDcoinToken());
discoinManager = new DiscoinManager();
}
if (shards == 0) {
System.out.println("You must enter the number of shards in your \"config.json\"! Please go back and specify it before launching.");
System.exit(0);
}
if (token == null) {
System.out.println("Token was not specified in \"config.json\"! Please go back and specify one before launching!");
} else {
JDABuilder builder = new JDABuilder(AccountType.BOT).setToken(token)
.setReconnectQueue(new SessionReconnectQueue())
.addEventListener(new Listener())
.addEventListener(waiter)
.addEventListener(gamesManager);
if (shards > 1) {
for (int i = 0; i < shards; i++) {
jdas[i] = builder.useSharding(i, shards).buildAsync();
}
} else {
jdas[0] = builder.buildAsync();
}
for (JDA jda : jdas) {
CommandRegistry.getForClient(jda).registerAll(Help.help, Purge.purge, Say.say, Granddad.granddad, TicketCommand.ticket, Lenny.lenny,
Shrug.shrug, Credits.credits, Avatar.avatar, TagCommand.tagCommand, AddAllowedUser.addAllowedUser, AddGame.addGame, Triggered.triggered, Gril.gril,
Salt.salt, JustRight.justRight, GetInvite.getInvite, Ban.ban, Kick.kick, Prefix.prefix, AutoRole.autoRole, Announce.announce,
Broadcast.broadcast, Stats.stats, Google.google, Lmgtfy.lmgtfy, Bots.bots, Shutdown.shutdown, UrbanDictionary.UrbanDictionary,
Emojify.emojify, AllowedUsers.allowedUsers, CoinFlip.coinFlip, Roll.roll, ListServers.listServers, Strawpoll.strawpoll, Poll.poll,
Poll.vote, AddRole.addRole, RemoveRole.removeRole, Quote.quote, Support.support, Eval.eval, Byemom.byemom, Queue.queue,
Skip.skip, Playlist.playlist, Song.song, Stop.stop, Volume.volume, Host.host, Music.music, Pause.pause, VoteSkip.voteskip, Repeat.repeat, Invite.invite,
Erase.erase, Johnny.johnny, LongLive.longlive, BlockUser.blockUser, DELET.delet, AddPatron.addPatron, RemovePatron.removePatron,
Poosy.poosy, EightBall.eightBall, Pick.pick, GameCommand.game, ProfileCommand.profile, FullWidth.fullwidth, ShopCommand.shop, MyPlaylist.myPlaylist,
Rip.rip, RateWaifu.rateWaifu, Gabe.gabe, Changelog.changelog, LotteryCommand.lottery, Shuffle.shuffle, Balance.balanace, SlotMachine.slotMachine,
Pay.pay);
}
for (Action action : Action.values()) {
List<String> responses = GSONUtils.getResponder(action).getResponses();
KekBot.responses.put(action, responses);
}
}
}
开发者ID:Godson777,项目名称:KekBot,代码行数:49,代码来源:KekBot.java
示例7: ProvidingSessionController
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
public ProvidingSessionController(SessionReconnectQueue queue, ShardedRateLimiter rateLimiter)
{
this.queue = queue;
this.rateLimiter = rateLimiter;
}
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:6,代码来源:ProvidingSessionController.java
示例8: createReconnectQueue
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
/**
* This method creates the internal {@link net.dv8tion.jda.core.requests.SessionReconnectQueue SessionReconnectQueue}.
* It is intended as a hook for custom implementations to create their own queue.
*
* <p><b>NOTE: The default implementation will add reconnects to the same queue as connects so they don't interfere with each other
* (they share the same rate limit). If you override this you need to take care of it yourself.</b>
*
* @return A new ScheduledExecutorService
*
* @deprecated
* Use {@link net.dv8tion.jda.core.utils.SessionController SessionController} directly instead
*/
@Deprecated
protected SessionReconnectQueue createReconnectQueue()
{
return new ForwardingSessionReconnectQueue(
jda -> queue.add(jda.getShardInfo().getShardId()),
jda -> queue.remove(jda.getShardInfo().getShardId()));
}
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:20,代码来源:DefaultShardManager.java
示例9: setReconnectQueue
import net.dv8tion.jda.core.requests.SessionReconnectQueue; //导入依赖的package包/类
/**
* Sets the queue that will be used to reconnect sessions.
* <br>This will ensure that sessions do not reconnect at the same time!
*
* <p><b>It is required to use the same instance of this queue for all JDA sessions of the same bot account!
* <br>Not doing that may result in <u>API spam and finally an IP ban.</u></b>
*
* @param queue
* {@link net.dv8tion.jda.core.requests.SessionReconnectQueue SessionReconnectQueue} to use
*
* @return The JDABuilder instance. Useful for chaining.
*
* @deprecated
* This system has been completely moved into a new central object {@link net.dv8tion.jda.core.utils.SessionController SessionController}.
* <br>Use {@link #setSessionController(SessionController)} instead!
*/
@Deprecated
public JDABuilder setReconnectQueue(SessionReconnectQueue queue)
{
this.reconnectQueue = queue;
return this;
}
开发者ID:DV8FromTheWorld,项目名称:JDA,代码行数:23,代码来源:JDABuilder.java
注:本文中的net.dv8tion.jda.core.requests.SessionReconnectQueue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论