Implement custom gallery emojis
This commit is contained in:
parent
09f142b48d
commit
0f1316aa30
@ -6,6 +6,8 @@
|
||||
package dev.salmonllama.fsbot.commands.developer;
|
||||
|
||||
import com.vdurmont.emoji.EmojiManager;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import dev.salmonllama.fsbot.config.BotConfig;
|
||||
import dev.salmonllama.fsbot.database.controllers.GalleryController;
|
||||
import dev.salmonllama.fsbot.database.models.GalleryChannel;
|
||||
import dev.salmonllama.fsbot.guthix.Command;
|
||||
@ -38,6 +40,8 @@ public class CreateGalleryCommand extends Command { // TODO: This command needs
|
||||
ctx.reply("Args are incorrect");
|
||||
return;
|
||||
}
|
||||
|
||||
String[] args = ctx.getArgs();
|
||||
// Check if the channel is already a registered gallery channel.
|
||||
// Create a gallery channel of the current channel.
|
||||
// Store the gallery channel in the database.
|
||||
@ -48,12 +52,19 @@ public class CreateGalleryCommand extends Command { // TODO: This command needs
|
||||
return;
|
||||
}
|
||||
|
||||
String tag = ctx.getArgs()[0];
|
||||
String tag = args[0];
|
||||
|
||||
String emoji;
|
||||
if (args.length == 2) {
|
||||
emoji = EmojiParser.parseToAliases(args[1]);
|
||||
} else {
|
||||
emoji = BotConfig.DEFAULT_REACTION;
|
||||
}
|
||||
|
||||
GalleryChannel.GalleryBuilder galleryBuilder = new GalleryChannel.GalleryBuilder();
|
||||
galleryBuilder.setChannelId(channelId);
|
||||
galleryBuilder.setTag(tag);
|
||||
galleryBuilder.setEmoji(":heartpulse:");
|
||||
galleryBuilder.setEmoji(emoji);
|
||||
|
||||
ctx.getServer().ifPresent(server -> {
|
||||
galleryBuilder.setServerId(server.getIdAsString());
|
||||
|
@ -69,6 +69,9 @@ public class BotConfig {
|
||||
@ConfigurationOption
|
||||
public static String IMGUR_BEARER = "imgur bearer here";
|
||||
|
||||
@ConfigurationOption
|
||||
public static String DEFAULT_REACTION = ":heartpulse:";
|
||||
|
||||
@ConfigurationOption
|
||||
public static String HOME_SERVER = "340511685024546816";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user