net.dv8tion.jda.api.events.ReadyEvent Java Examples
The following examples show how to use
net.dv8tion.jda.api.events.ReadyEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReadyShutdownListener.java From SkyBot with GNU Affero General Public License v3.0 | 6 votes |
private void onReady(ReadyEvent event) { final JDA jda = event.getJDA(); logger.info("Logged in as {} (Shard {})", jda.getSelfUser().getAsTag(), jda.getShardInfo().getShardId()); //Start the timers if they have not been started yet if (!arePoolsRunning.get()) { logger.info("Starting spam-cache-cleaner!"); systemPool.scheduleAtFixedRate(spamFilter::clearMessages, 20, 13, TimeUnit.SECONDS); if (!variables.useApi()) { this.startSQLiteTimers(); } arePoolsRunning.set(true); // Load the patrons here so that they are loaded once GuildUtils.loadAllPatrons(variables.getDatabaseAdapter()); } }
Example #2
Source File: ReadyShutdownListener.java From SkyBot with GNU Affero General Public License v3.0 | 5 votes |
@Override public void onEvent(@Nonnull GenericEvent event) { if (event instanceof ReadyEvent) { this.onReady((ReadyEvent) event); } else if (event instanceof GuildMessageUpdateEvent) { this.onGuildMessageUpdate((GuildMessageUpdateEvent) event); } else if (event instanceof GuildMessageReceivedEvent) { this.onGuildMessageReceived((GuildMessageReceivedEvent) event); } }
Example #3
Source File: Shard.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
public Shard(int id) { this.id = id; this.listener = new ListenerAdapter() { @Override public synchronized void onReady(@Nonnull ReadyEvent event) { jda = event.getJDA(); if (statusChange != null) { statusChange.cancel(true); } statusChange = MantaroBot.getInstance().getExecutorService() .scheduleAtFixedRate(Shard.this::changeStatus, 0, 10, TimeUnit.MINUTES); } }; }
Example #4
Source File: MantaroCore.java From MantaroBot with GNU General Public License v3.0 | 5 votes |
@Override public void onEvent(@Nonnull GenericEvent event) { if (event instanceof ReadyEvent) { var sm = event.getJDA().getShardManager(); if (sm == null) throw new AssertionError(); latch.countDown(); } }
Example #5
Source File: StatisticsListener.java From JuniperBot with GNU General Public License v3.0 | 4 votes |
@Override public void onReady(ReadyEvent event) { statisticsService.notifyProviders(event.getJDA()); }
Example #6
Source File: DiscordServiceImpl.java From JuniperBot with GNU General Public License v3.0 | 4 votes |
@Override public void onReady(ReadyEvent event) { mBeanExporter.registerManagedResource(new JmxJDAMBean(event.getJDA())); setUpStatus(); }
Example #7
Source File: ReadyListener.java From Arraybot with Apache License 2.0 | 2 votes |
/** * This event gets fired when JDA is ready and all * cached objects are usable. * @param event The event. */ @Override public void onReady(ReadyEvent event) { manager.ready(event.getJDA()); }