Added temporary bot-log redirect for zammy event

This commit is contained in:
Aleksei Gryczewski 2022-06-29 21:56:26 -04:00
parent a21b3471e1
commit 18be26d5ca
6 changed files with 76 additions and 0 deletions

View File

@ -77,6 +77,15 @@ public class EditMetaCommand extends Command {
.setColor(Color.YELLOW)
.addField("Edited By:", ctx.getAuthor().getDiscriminatedName());
// TODO: START ZAMMY
if (outfit.getTag().equals("zammy"))
{
ctx.getApi().getServerTextChannelById(BotConfig.ZAMMY_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);
}
// TODO: END ZAMMY
ctx.getApi().getServerTextChannelById(BotConfig.OUTFIT_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);

View File

@ -77,6 +77,15 @@ public class RemoveOutfitCommand extends Command {
.setColor(Color.RED)
.addField("Deleted By:", ctx.getAuthor().getDiscriminatedName());
// TODO: START ZAMMY
if (outfit.getTag().equals("zammy"))
{
ctx.getApi().getServerTextChannelById(BotConfig.ZAMMY_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);
}
// TODO: END ZAMMY
ctx.getApi().getServerTextChannelById(BotConfig.OUTFIT_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);

View File

@ -78,6 +78,15 @@ public class RestoreOutfitCommand extends Command {
.setColor(Color.BLUE)
.addField("Restored By:", ctx.getAuthor().getDiscriminatedName());
// TODO: START ZAMMY
if (outfit.getTag().equals("zammy"))
{
ctx.getApi().getServerTextChannelById(BotConfig.OUTFIT_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);
}
// TODO: END ZAMMY
ctx.getApi().getServerTextChannelById(BotConfig.OUTFIT_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);

View File

@ -81,6 +81,15 @@ public class RetagCommand extends Command {
.setThumbnail(outfit.getLink())
.addField("New tag:", newTag);
// TODO: START ZAMMY
if (outfit.getTag().equals("zammy"))
{
ctx.getApi().getServerTextChannelById(BotConfig.ZAMMY_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);
}
// TODO: END ZAMMY
ctx.getApi().getServerTextChannelById(BotConfig.OUTFIT_LOG).ifPresent(
chnl -> chnl.sendMessage(log)
);

View File

@ -56,6 +56,9 @@ public class BotConfig {
@ConfigurationOption
public static String OUTFIT_LOG = "outfit log channel";
@ConfigurationOption
public static String ZAMMY_LOG = "zammy log here";
@ConfigurationOption
public static String ACTIVITY_LOG = "bot_log_channel";

View File

@ -118,6 +118,43 @@ public class ImageListener implements MessageCreateListener {
OutfitController.insert(outfit).thenAcceptAsync((Void) -> {
// Log the outfit
// TODO: START ZAMMY LOG
if (outfit.getTag().equals("zammy"))
{
event.getApi().getServerTextChannelById(BotConfig.ZAMMY_LOG).ifPresentOrElse(chnl ->
{
EmbedBuilder response = new EmbedBuilder()
.setTitle("Outfit Added")
.setAuthor(event.getMessageAuthor())
.setThumbnail(outfit.getLink())
.setFooter(String.format("%s | %s", outfit.getTag(), outfit.getId()))
.setUrl(outfit.getLink())
.setColor(Color.GREEN)
.addField("Uploaded:", outfit.getCreated().toString())
.addField("Discord Name:", outfit.getDiscordName());
if (!outfit.getMeta().equals("")) {
response.addField("Meta:", outfit.getMeta());
}
chnl.sendMessage(response);
logger.info(String.format("Outfit from %s successfully added to the zammy event.", event.getMessageAuthor().getDiscriminatedName()));
// Add the reaction to the original message
GalleryController.getEmoji(channel.getIdAsString()).thenAcceptAsync(
emoji -> event.getMessage().addReaction(EmojiParser.parseToUnicode(emoji))
).exceptionally(ExceptionLogger.get());
}, () ->
{
// Fallback error message to me
event.getApi().getUserById(BotConfig.BOT_OWNER).thenAcceptAsync(
user -> user.sendMessage("Could not find OUTFIT LOG")
);
});
}
// TODO: END ZAMMY LOG
event.getApi().getServerTextChannelById(BotConfig.OUTFIT_LOG).ifPresentOrElse(chnl -> {
EmbedBuilder response = new EmbedBuilder()
.setTitle("Outfit Added")