Compare commits
No commits in common. "5e48652587c7b58662a166cb7ff67fed7cc3c68c" and "0f54fe856ece067e4e59d220908e4844f5367ed8" have entirely different histories.
5e48652587
...
0f54fe856e
@ -3,6 +3,7 @@ package wtf.beatrice.hidekobot;
|
|||||||
import net.dv8tion.jda.api.JDA;
|
import net.dv8tion.jda.api.JDA;
|
||||||
import net.dv8tion.jda.api.JDABuilder;
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
import net.dv8tion.jda.api.OnlineStatus;
|
import net.dv8tion.jda.api.OnlineStatus;
|
||||||
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
import net.dv8tion.jda.api.requests.GatewayIntent;
|
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||||
import sun.misc.Signal;
|
import sun.misc.Signal;
|
||||||
import wtf.beatrice.hidekobot.commands.completer.AvatarCommandCompleter;
|
import wtf.beatrice.hidekobot.commands.completer.AvatarCommandCompleter;
|
||||||
@ -122,7 +123,6 @@ public class HidekoBot
|
|||||||
slashCommandListener.registerCommand(new DieCommand());
|
slashCommandListener.registerCommand(new DieCommand());
|
||||||
slashCommandListener.registerCommand(new HelpCommand());
|
slashCommandListener.registerCommand(new HelpCommand());
|
||||||
slashCommandListener.registerCommand(new InviteCommand());
|
slashCommandListener.registerCommand(new InviteCommand());
|
||||||
slashCommandListener.registerCommand(new LoveCalculatorCommand());
|
|
||||||
slashCommandListener.registerCommand(new MagicBallCommand());
|
slashCommandListener.registerCommand(new MagicBallCommand());
|
||||||
slashCommandListener.registerCommand(new PingCommand());
|
slashCommandListener.registerCommand(new PingCommand());
|
||||||
slashCommandListener.registerCommand(new SayCommand());
|
slashCommandListener.registerCommand(new SayCommand());
|
||||||
|
@ -7,6 +7,7 @@ import net.dv8tion.jda.api.entities.channel.Channel;
|
|||||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||||
|
import net.dv8tion.jda.api.interactions.InteractionHook;
|
||||||
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package wtf.beatrice.hidekobot.commands.base;
|
|
||||||
|
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
|
||||||
import net.dv8tion.jda.api.entities.User;
|
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
|
||||||
import wtf.beatrice.hidekobot.util.RandomUtil;
|
|
||||||
|
|
||||||
public class LoveCalculator
|
|
||||||
{
|
|
||||||
public static MessageEmbed buildEmbed(User author, User user1, User user2)
|
|
||||||
{
|
|
||||||
int loveAmount = RandomUtil.getRandomNumber(0, 100);
|
|
||||||
|
|
||||||
String formattedAmount = loveAmount + "%";
|
|
||||||
if(loveAmount <= 30) formattedAmount += "... \uD83D\uDE22";
|
|
||||||
else if(loveAmount < 60) formattedAmount += "! \uD83E\uDDD0";
|
|
||||||
else if(loveAmount < 75) formattedAmount += "!!! \uD83E\uDD73";
|
|
||||||
else formattedAmount = "✨ " + formattedAmount + "!!! \uD83D\uDE0D\uD83D\uDCA5";
|
|
||||||
|
|
||||||
EmbedBuilder embedBuilder = new EmbedBuilder();
|
|
||||||
embedBuilder.setColor(Cache.getBotColor());
|
|
||||||
embedBuilder.setAuthor(author.getAsTag(), null, author.getAvatarUrl());
|
|
||||||
embedBuilder.setTitle("Love Calculator");
|
|
||||||
|
|
||||||
embedBuilder.addField("\uD83D\uDC65 People",
|
|
||||||
user1.getAsMention() + " & " + user2.getAsMention(),
|
|
||||||
false);
|
|
||||||
|
|
||||||
embedBuilder.addField("❤️\u200D\uD83D\uDD25 Match",
|
|
||||||
formattedAmount,
|
|
||||||
false);
|
|
||||||
|
|
||||||
return embedBuilder.build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,10 +17,7 @@ import wtf.beatrice.hidekobot.Cache;
|
|||||||
import wtf.beatrice.hidekobot.datasources.DatabaseSource;
|
import wtf.beatrice.hidekobot.datasources.DatabaseSource;
|
||||||
import wtf.beatrice.hidekobot.util.SerializationUtil;
|
import wtf.beatrice.hidekobot.util.SerializationUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class UrbanDictionary
|
public class UrbanDictionary
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.commands.base.Alias;
|
import wtf.beatrice.hidekobot.commands.base.Alias;
|
||||||
|
import wtf.beatrice.hidekobot.commands.base.Say;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
||||||
|
|
||||||
|
@ -4,14 +4,12 @@ import net.dv8tion.jda.api.EmbedBuilder;
|
|||||||
import net.dv8tion.jda.api.Permission;
|
import net.dv8tion.jda.api.Permission;
|
||||||
import net.dv8tion.jda.api.entities.IMentionable;
|
import net.dv8tion.jda.api.entities.IMentionable;
|
||||||
import net.dv8tion.jda.api.entities.Mentions;
|
import net.dv8tion.jda.api.entities.Mentions;
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
|
||||||
import net.dv8tion.jda.api.entities.User;
|
import net.dv8tion.jda.api.entities.User;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
import wtf.beatrice.hidekobot.HidekoBot;
|
import wtf.beatrice.hidekobot.HidekoBot;
|
||||||
import wtf.beatrice.hidekobot.commands.base.LoveCalculator;
|
|
||||||
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
import wtf.beatrice.hidekobot.objects.commands.CommandCategory;
|
||||||
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
import wtf.beatrice.hidekobot.objects.commands.MessageCommand;
|
||||||
import wtf.beatrice.hidekobot.util.RandomUtil;
|
import wtf.beatrice.hidekobot.util.RandomUtil;
|
||||||
@ -88,8 +86,28 @@ public class LoveCalculatorCommand implements MessageCommand
|
|||||||
user2 = HidekoBot.getAPI().retrieveUserById(mentionedUserId).complete();
|
user2 = HidekoBot.getAPI().retrieveUserById(mentionedUserId).complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageEmbed embed = LoveCalculator.buildEmbed(event.getAuthor(), user1, user2);
|
int loveAmount = RandomUtil.getRandomNumber(0, 100);
|
||||||
event.getChannel().sendMessageEmbeds(embed).queue();
|
|
||||||
|
String formattedAmount = loveAmount + "%";
|
||||||
|
if(loveAmount <= 30) formattedAmount += "... \uD83D\uDE22";
|
||||||
|
else if(loveAmount < 60) formattedAmount += "! \uD83E\uDDD0";
|
||||||
|
else if(loveAmount < 75) formattedAmount += "!!! \uD83E\uDD73";
|
||||||
|
else formattedAmount = "✨ " + formattedAmount + "!!! \uD83D\uDE0D\uD83D\uDCA5";
|
||||||
|
|
||||||
|
EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
|
embedBuilder.setColor(Cache.getBotColor());
|
||||||
|
embedBuilder.setAuthor(event.getAuthor().getAsTag(), null, event.getAuthor().getAvatarUrl());
|
||||||
|
embedBuilder.setTitle("Love Calculator");
|
||||||
|
|
||||||
|
embedBuilder.addField("\uD83D\uDC65 People",
|
||||||
|
user1.getAsMention() + " & " + user2.getAsMention(),
|
||||||
|
false);
|
||||||
|
|
||||||
|
embedBuilder.addField("❤️\u200D\uD83D\uDD25 Match",
|
||||||
|
formattedAmount,
|
||||||
|
false);
|
||||||
|
|
||||||
|
event.getChannel().sendMessageEmbeds(embedBuilder.build()).queue();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
package wtf.beatrice.hidekobot.commands.slash;
|
|
||||||
|
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
|
||||||
import net.dv8tion.jda.api.entities.User;
|
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
|
|
||||||
import net.dv8tion.jda.api.interactions.commands.OptionType;
|
|
||||||
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
|
|
||||||
import net.dv8tion.jda.api.interactions.commands.build.Commands;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import wtf.beatrice.hidekobot.commands.base.LoveCalculator;
|
|
||||||
import wtf.beatrice.hidekobot.objects.commands.SlashCommandImpl;
|
|
||||||
|
|
||||||
public class LoveCalculatorCommand extends SlashCommandImpl
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public CommandData getSlashCommandData()
|
|
||||||
{
|
|
||||||
|
|
||||||
return Commands.slash("lovecalc",
|
|
||||||
"Calculate how much two people love each other.")
|
|
||||||
|
|
||||||
.addOption(OptionType.MENTIONABLE,
|
|
||||||
"first",
|
|
||||||
"The first person to account for",
|
|
||||||
true)
|
|
||||||
|
|
||||||
.addOption(OptionType.MENTIONABLE,
|
|
||||||
"second",
|
|
||||||
"The second person to account for",
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void runSlashCommand(@NotNull SlashCommandInteractionEvent event)
|
|
||||||
{
|
|
||||||
User firstUser, secondUser;
|
|
||||||
|
|
||||||
OptionMapping firsUserArg = event.getOption("first");
|
|
||||||
if(firsUserArg != null)
|
|
||||||
{
|
|
||||||
firstUser = firsUserArg.getAsUser();
|
|
||||||
} else {
|
|
||||||
event.reply("\uD83D\uDE22 I need to know who to check! Please mention them.")
|
|
||||||
.setEphemeral(true)
|
|
||||||
.queue();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OptionMapping secondUserArg = event.getOption("second");
|
|
||||||
if(secondUserArg != null)
|
|
||||||
{
|
|
||||||
secondUser = secondUserArg.getAsUser();
|
|
||||||
} else {
|
|
||||||
secondUser = event.getUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageEmbed embed = LoveCalculator.buildEmbed(event.getUser(), firstUser, secondUser);
|
|
||||||
event.replyEmbeds(embed).queue();
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,6 +2,8 @@ package wtf.beatrice.hidekobot.util;
|
|||||||
|
|
||||||
import wtf.beatrice.hidekobot.Cache;
|
import wtf.beatrice.hidekobot.Cache;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class RandomUtil
|
public class RandomUtil
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user