Added MemberCountCommand
This commit is contained in:
parent
4180b25348
commit
bc68fe6c41
@ -0,0 +1,19 @@
|
|||||||
|
package zone.themcgamer.core.badSportSystem.command;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import zone.themcgamer.core.account.AccountManager;
|
||||||
|
|
||||||
|
import zone.themcgamer.core.command.Command;
|
||||||
|
import zone.themcgamer.core.command.CommandProvider;
|
||||||
|
import zone.themcgamer.data.Rank;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MuteCommand {
|
||||||
|
private final AccountManager accountManager;
|
||||||
|
|
||||||
|
@Command(name = "mute", aliases = { "bssmute" }, description = "Mute a player", ranks = { Rank.HELPER }, playersOnly = true)
|
||||||
|
public void onCommand(CommandProvider command) {
|
||||||
|
Player player = command.getPlayer();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package zone.themcgamer.discordbot;
|
package zone.themcgamer.discordbot;
|
||||||
|
|
||||||
import com.jagrosh.jdautilities.command.CommandClientBuilder;
|
import com.jagrosh.jdautilities.command.CommandClientBuilder;
|
||||||
|
import com.jagrosh.jdautilities.command.annotation.JDACommand;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
@ -39,6 +40,7 @@ public class MGZBot {
|
|||||||
commandClientBuilder.addCommand(new MessageCommand());
|
commandClientBuilder.addCommand(new MessageCommand());
|
||||||
commandClientBuilder.addCommand(new EditMessageCommand());
|
commandClientBuilder.addCommand(new EditMessageCommand());
|
||||||
commandClientBuilder.addCommand(new AddReactionToMessageCommand());
|
commandClientBuilder.addCommand(new AddReactionToMessageCommand());
|
||||||
|
commandClientBuilder.addCommand(new MemberCountCommand());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
jda = JDABuilder.createDefault(BotConstants.TOKEN)
|
jda = JDABuilder.createDefault(BotConstants.TOKEN)
|
||||||
|
39
discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/MemberCountCommand.java
Normal file
39
discordbot/src/main/java/zone/themcgamer/discordbot/command/impl/MemberCountCommand.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package zone.themcgamer.discordbot.command.impl;
|
||||||
|
|
||||||
|
import com.jagrosh.jdautilities.command.CommandEvent;
|
||||||
|
import com.jagrosh.jdautilities.command.annotation.JDACommand;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import zone.themcgamer.core.cooldown.Cooldown;
|
||||||
|
import zone.themcgamer.discordbot.command.BaseCommand;
|
||||||
|
import zone.themcgamer.discordbot.guild.Guild;
|
||||||
|
import zone.themcgamer.discordbot.utilities.EmbedUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MemberCountCommand extends BaseCommand {
|
||||||
|
|
||||||
|
public MemberCountCommand() {
|
||||||
|
name = "membercount";
|
||||||
|
aliases = new String[]{"members"};
|
||||||
|
help = "Shows the amount of members in the guild";
|
||||||
|
cooldown = 10;
|
||||||
|
arguments = "";
|
||||||
|
guildOnly = true;
|
||||||
|
guilds = Arrays.asList(Guild.MAIN, Guild.TEAM, Guild.TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(CommandEvent event, List<String> args) {
|
||||||
|
net.dv8tion.jda.api.entities.Guild guild = event.getGuild();
|
||||||
|
guild.loadMembers().onSuccess(members -> {
|
||||||
|
EmbedBuilder embedBuilder = EmbedUtils.defaultEmbed();
|
||||||
|
embedBuilder.setTitle("Member Count");
|
||||||
|
embedBuilder.addField("Humans", String.valueOf(members.stream().filter(member -> !member.getUser().isBot()).count()), true);
|
||||||
|
embedBuilder.addField("Bots", String.valueOf(members.stream().filter(member -> member.getUser().isBot()).count()), true);
|
||||||
|
|
||||||
|
event.getChannel().sendMessage(embedBuilder.build()).queue();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -140,7 +140,7 @@ public class GuildsListener extends ListenerAdapter {
|
|||||||
embedBuilder.setDescription(event.getOldPosition() + " -> " + event.getNewPosition());
|
embedBuilder.setDescription(event.getOldPosition() + " -> " + event.getNewPosition());
|
||||||
embedBuilder.addField("Role", role.getAsMention(), false);
|
embedBuilder.addField("Role", role.getAsMention(), false);
|
||||||
embedBuilder.addField("Id", role.getId(), false);
|
embedBuilder.addField("Id", role.getId(), false);
|
||||||
embedBuilder.addField("Color", Objects.requireNonNull(role.getColor()).toString(), false);
|
embedBuilder.addField("Color", String.valueOf(role.getColor().getRGB()), false);
|
||||||
embedBuilder.addField("Guild", guild.getName(), true);
|
embedBuilder.addField("Guild", guild.getName(), true);
|
||||||
MessageUtils.sendLogMessage(embedBuilder);
|
MessageUtils.sendLogMessage(embedBuilder);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user