Skip to content

Commit

Permalink
Fixed the Member Count Command
Browse files Browse the repository at this point in the history
  • Loading branch information
beanbeanjuice committed Jul 10, 2024
1 parent 174a973 commit eb7a80f
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.beanbeanjuice.cafebot.utility.commands.ICommand;
import com.beanbeanjuice.cafebot.utility.helper.Helper;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;

public class MemberCountCommand extends Command implements ICommand {
Expand All @@ -17,13 +16,12 @@ public MemberCountCommand(final CafeBot cafeBot) {

@Override
public void handle(SlashCommandInteractionEvent event) {
Guild guild = event.getGuild();
int members = guild.getMemberCount();

event.getHook().sendMessageEmbeds(Helper.successEmbed(
"Member Count",
String.format("There are %d people in this server!", members)
)).queue();
event.getGuild().retrieveMetaData().queue((metadata) -> {
event.getHook().sendMessageEmbeds(Helper.successEmbed(
"Member Count",
String.format("There are %d people in this server!", metadata.getApproximateMembers())
)).queue();
});
}

@Override
Expand Down

0 comments on commit eb7a80f

Please sign in to comment.