Compare commits
2 commits
523ce4173d
...
5ba6039d4a
Author | SHA1 | Date | |
---|---|---|---|
Anya | 5ba6039d4a | ||
Anya | 7f9d7f3443 |
|
@ -31,7 +31,7 @@ public class AvatarCommand extends CommandClass {
|
||||||
|
|
||||||
EmbedBuilder eb = new EmbedBuilder()
|
EmbedBuilder eb = new EmbedBuilder()
|
||||||
.setColor(EmbedUI.INFO)
|
.setColor(EmbedUI.INFO)
|
||||||
.setAuthor(user.getName())
|
.setAuthor(user.getName() + "#" + user.getDiscriminator())
|
||||||
.setImage(user.getEffectiveAvatarUrl() + "?size=2048")
|
.setImage(user.getEffectiveAvatarUrl() + "?size=2048")
|
||||||
.setFooter(EmbedUI.BRAND)
|
.setFooter(EmbedUI.BRAND)
|
||||||
.setTimestamp(ZonedDateTime.now());
|
.setTimestamp(ZonedDateTime.now());
|
||||||
|
|
83
src/main/java/moe/oko/Kiafumi/command/InfoCommand.java
Normal file
83
src/main/java/moe/oko/Kiafumi/command/InfoCommand.java
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
package moe.oko.Kiafumi.command;
|
||||||
|
|
||||||
|
import moe.oko.Kiafumi.util.CommandInfo;
|
||||||
|
import moe.oko.Kiafumi.util.CommandType;
|
||||||
|
import moe.oko.Kiafumi.util.EmbedUI;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.entities.Role;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class InfoCommand extends CommandClass{
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() { return false; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() { return "Info"; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void newCommand(String name, SlashCommandInteractionEvent e) {
|
||||||
|
switch (name){
|
||||||
|
case "userinfo":
|
||||||
|
e.deferReply().queue();
|
||||||
|
|
||||||
|
// Setup variables
|
||||||
|
final var member = e.getOptions().size() == 0
|
||||||
|
? e.getMember()
|
||||||
|
: e.getOption("user").getAsMember();
|
||||||
|
final var dTF = DateTimeFormatter.ofPattern("MM-dd-yyyy");
|
||||||
|
|
||||||
|
// Build embed
|
||||||
|
EmbedBuilder eb1 = new EmbedBuilder()
|
||||||
|
.setColor(EmbedUI.INFO)
|
||||||
|
.setAuthor(member.getEffectiveName() + "#" + member.getUser().getDiscriminator())
|
||||||
|
.addField("Joined Server", member.getTimeJoined().format(dTF), true)
|
||||||
|
.addField("Joined Discord", member.getTimeCreated().format(dTF), true)
|
||||||
|
.addField("Roles", member.getRoles().stream().map(Role::getName).reduce((a, b) -> a + ", " + b).orElse("None"), false)
|
||||||
|
.setThumbnail(member.getEffectiveAvatarUrl())
|
||||||
|
.setFooter("ID: " + member.getId())
|
||||||
|
.setTimestamp(ZonedDateTime.now());
|
||||||
|
e.getHook().sendMessageEmbeds(eb1.build()).queue();
|
||||||
|
return;
|
||||||
|
case "serverinfo":
|
||||||
|
e.deferReply().queue();
|
||||||
|
// Setup variables
|
||||||
|
final var guild = e.getGuild();
|
||||||
|
final var dTF2 = DateTimeFormatter.ofPattern("MM-dd-yyyy");
|
||||||
|
|
||||||
|
// Build Embed
|
||||||
|
EmbedBuilder eb2 = new EmbedBuilder()
|
||||||
|
.setColor(EmbedUI.INFO)
|
||||||
|
.setAuthor(guild.getName())
|
||||||
|
.addField("Members", "**" + guild.getMemberCount() + "** member(s) \n Owner: "
|
||||||
|
+ guild.getOwner().getEffectiveName() + "#" + guild.getOwner().getUser().getDiscriminator(), true)
|
||||||
|
.addField("Channels", "**" + guild.getTextChannels().size() + "** Text \n **"
|
||||||
|
+ guild.getVoiceChannels().size() + "** Voice", true)
|
||||||
|
.addField("Other", "Roles: **" + guild.getRoles().size() + "** \n"
|
||||||
|
+ "Created: " + guild.getTimeCreated().format(dTF2), true)
|
||||||
|
.setThumbnail(guild.getIconUrl())
|
||||||
|
.setFooter("ID: " + guild.getId());
|
||||||
|
e.getHook().sendMessageEmbeds(eb2.build()).queue();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommandInfo> getSlashCommandInfo() {
|
||||||
|
List<CommandInfo> cil = new ArrayList<>();
|
||||||
|
CommandInfo ci = new CommandInfo("userinfo", "Returns information about a user.", CommandType.COMMAND);
|
||||||
|
ci.addOption("user", "The user to get information about.", OptionType.USER, false);
|
||||||
|
|
||||||
|
CommandInfo ci2 = new CommandInfo("serverinfo", "Returns information about the server.", CommandType.COMMAND);
|
||||||
|
|
||||||
|
cil.add(ci);
|
||||||
|
cil.add(ci2);
|
||||||
|
|
||||||
|
return cil;
|
||||||
|
}
|
||||||
|
}
|
2
src/main/java/moe/oko/Kiafumi/command/StatsCommand.java
Normal file
2
src/main/java/moe/oko/Kiafumi/command/StatsCommand.java
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package moe.oko.Kiafumi.command;public class StatsCommand {
|
||||||
|
}
|
Loading…
Reference in a new issue