-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
756c829
commit 5a663bf
Showing
3 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
bot/src/main/java/de/chojo/gamejam/listener/ReadyStateChangeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
* | ||
* Copyright (C) 2022 DevCord Team and Contributor | ||
*/ | ||
|
||
package de.chojo.gamejam.listener; | ||
|
||
import net.dv8tion.jda.api.entities.Activity; | ||
import net.dv8tion.jda.api.entities.Guild; | ||
import net.dv8tion.jda.api.events.ReadyEvent; | ||
import net.dv8tion.jda.api.events.ShutdownEvent; | ||
import net.dv8tion.jda.api.hooks.SubscribeEvent; | ||
import net.dv8tion.jda.api.sharding.ShardManager; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ReadyStateChangeListener { | ||
|
||
private final ShardManager shardManager; | ||
private static final Logger log = LoggerFactory.getLogger(ReadyStateChangeListener.class); | ||
|
||
public ReadyStateChangeListener(ShardManager shardManager) { | ||
this.shardManager = shardManager; | ||
} | ||
|
||
@SubscribeEvent | ||
public void finishedLoading(ReadyEvent readyEvent){ | ||
log.warn("Available Guilds: {}",readyEvent.getGuildAvailableCount()); | ||
shardManager.setActivity(Activity.playing("Plugin-Jam-Bot")); | ||
for (Guild guild : shardManager.getGuilds()) { | ||
guild.loadMembers(member -> { | ||
log.warn("Loaded member \"{}\" of guild \"{}\"", member.getEffectiveName(), guild.getName()); | ||
}); | ||
} | ||
} | ||
|
||
@SubscribeEvent | ||
public void shutdown(ShutdownEvent shutdownEvent){ | ||
shardManager.setActivity(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters