forked from Fascinated/Bat
Compare commits
No commits in common. "d54d2ffe0dda0d911284afeee7b4e8bf8cb3522c" and "9a1d011ff2853c05181e838d507842220c50729b" have entirely different histories.
d54d2ffe0d
...
9a1d011ff2
@ -1,36 +0,0 @@
|
||||
package cc.fascinated.bat.command.impl.fun;
|
||||
|
||||
import cc.fascinated.bat.command.BatCommand;
|
||||
import cc.fascinated.bat.command.Category;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.common.EmbedUtils;
|
||||
import cc.fascinated.bat.common.WebRequest;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import cc.fascinated.bat.model.token.randomfox.RandomFoxToken;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author Nick (okNick)
|
||||
*/
|
||||
@Component
|
||||
@CommandInfo(name = "fox", description = "Get a random fox image", category = Category.FUN, guildOnly = false)
|
||||
public class FoxCommand extends BatCommand {
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
||||
RandomFoxToken responseEntity = WebRequest.getAsEntity("https://randomfox.ca/floof/", RandomFoxToken.class);
|
||||
if (responseEntity == null) {
|
||||
interaction.reply("Failed to get a fox image!").queue();
|
||||
return;
|
||||
}
|
||||
|
||||
interaction.replyEmbeds(EmbedUtils.genericEmbed()
|
||||
.setAuthor("Here's a random fox image!")
|
||||
.setImage(responseEntity.getImage())
|
||||
.build()).queue();
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ public class SetTopicSubCommand extends BatSubCommand {
|
||||
String topic = interaction.getOption("topic").getAsString();
|
||||
if (topic.length() > 1024) {
|
||||
interaction.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("The topic must be 1024 characters or less!")
|
||||
.setDescription("The topic must be less than 1024 characters!")
|
||||
.build())
|
||||
.queue();
|
||||
return;
|
||||
|
@ -1,21 +0,0 @@
|
||||
package cc.fascinated.bat.model.token.randomfox;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author Nick (okNick)
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class RandomFoxToken {
|
||||
/**
|
||||
* The URL of the raw image.
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* The link of the image + other web info.
|
||||
*/
|
||||
private String link;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user