fixed emote add command

This commit is contained in:
nora 2021-01-25 13:53:08 +01:00
parent 08b91df73b
commit 01f7cd11f0
2 changed files with 21 additions and 20 deletions

View file

@ -5,6 +5,8 @@
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />

View file

@ -27,9 +27,8 @@ public class EmoteAddCommand extends Command {
@Override @Override
public void called(String args) { public void called(String args) {
List<Message.Attachment> attachments = event.getMessage().getAttachments(); List<Message.Attachment> attachments = event.getMessage().getAttachments();
Member author = event.getGuild().getMember(event.getAuthor()); event.getGuild().retrieveMember(event.getAuthor()).queue(member -> {
if(!member.getPermissions().contains(Permission.MANAGE_EMOTES)) {
if (author == null || !author.getPermissions().contains(Permission.MANAGE_EMOTES)) {
reply("You don't have the permissions to do that."); reply("You don't have the permissions to do that.");
} else if (attachments.size() == 0 || !attachments.get(0).isImage()) { } else if (attachments.size() == 0 || !attachments.get(0).isImage()) {
reply("No image attached"); reply("No image attached");
@ -50,7 +49,7 @@ public class EmoteAddCommand extends Command {
reply("Error while reading image. Please try again."); reply("Error while reading image. Please try again.");
} }
} }
});
} }
private byte[] readImage(Message.Attachment image) throws IOException { private byte[] readImage(Message.Attachment image) throws IOException {