Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Avatar Command
Browse files Browse the repository at this point in the history
  • Loading branch information
greg6775 committed Nov 23, 2019
1 parent ef1b1e1 commit df8e0dc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/bbn/hadder/Hadder.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private static void startBot() {
new RoleCommand(),
new RulesCommand(),
new FeedbackCommand(),
new AvatarCommand(),
new LinkCommand()), config, helpCommand);

builder.addEventListeners(
Expand All @@ -80,7 +81,7 @@ private static void startBot() {
new ReadyListener(rethink, config),
new LinkListener(rethink),
new RulesListener(rethink));


try {
shardManager = builder.build();
Expand Down
57 changes: 57 additions & 0 deletions src/main/java/com/bbn/hadder/commands/fun/AvatarCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.bbn.hadder.commands.fun;

/*
* @author Skidder / GregTCLTK
*/

import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.entities.Member;

public class AvatarCommand implements Command {

@Override
public void executed(String[] args, CommandEvent event) {
if (args.length == 0) {
Member member = event.getMember();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO, new EmbedBuilder()
.setTitle("Avatar of " + member.getUser().getAsTag()))
.setImage(member.getUser().getAvatarUrl())
.setFooter(member.getUser().getAsTag())
.build()).queue();
} else if (event.getMessage().getMentionedMembers().size() == 1) {
Member member = event.getMessage().getMentionedMembers().get(0);
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO, new EmbedBuilder()
.setTitle("Avatar of " + member.getUser().getAsTag()))
.setImage(member.getUser().getAvatarUrl())
.setFooter(member.getUser().getAsTag())
.build()).queue();
} else if (args[0].length() == 18){
Member member = event.getGuild().getMemberById(args[0]);
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.MessageType.INFO, new EmbedBuilder()
.setTitle("Avatar of " + member.getUser().getAsTag()))
.setImage(member.getUser().getAvatarUrl())
.setFooter(member.getUser().getAsTag())
.build()).queue();
} else {
event.getHelpCommand().sendHelp(this , event.getRethink(), event.getAuthor(), event.getTextChannel());
}
}

@Override
public String[] labels() {
return new String[]{"avatar"};
}

@Override
public String description() {
return "Sends the avatar of the specified member.";
}

@Override
public String usage() {
return "<@User>/<ID>";
}
}

0 comments on commit df8e0dc

Please sign in to comment.