Search in sources :

Example 46 with IMessage

use of sx.blah.discord.handle.obj.IMessage in project Shadbot by Shadorc.

the class HangmanManager method show.

private void show() {
    List<String> missesList = charsTested.stream().filter(letter -> !word.contains(letter)).collect(Collectors.toList());
    EmbedBuilder embed = EmbedUtils.getDefaultEmbed().setLenient(true).withAuthorIcon(this.getAuthor().getAvatarURL()).withAuthorName("Hangman Game").withThumbnail("https://lh5.ggpht.com/nIoJylIWCj1gKv9dxtd4CFE2aeXvG7MbvP0BNFTtTFusYlxozJRQmHizsIDxydaa7DHT=w300").withDescription("Type letters or enter a word if you think you've guessed it.").appendField("Word", this.getRepresentation(word), false).appendField("Misses", FormatUtils.format(missesList, chr -> chr.toString().toUpperCase(), ", "), false);
    if (this.isTaskDone()) {
        embed.withFooterText("Finished.");
    } else {
        embed.withFooterText(String.format("Use %scancel to cancel this game (Automatically cancelled in %d min in case of inactivity)", this.getPrefix(), IDLE_MIN));
    }
    if (failsCount > 0) {
        embed.withImage(IMG_LIST.get(Math.min(IMG_LIST.size(), failsCount) - 1));
    }
    RequestFuture<IMessage> msgRequest = message.send(embed.build());
    if (msgRequest != null) {
        msgRequest.get();
    }
}
Also used : MoneyEnum(me.shadorc.shadbot.data.stats.MoneyStatsManager.MoneyEnum) BotUtils(me.shadorc.shadbot.utils.BotUtils) ArrayList(java.util.ArrayList) StringUtils(me.shadorc.shadbot.utils.StringUtils) IMessage(sx.blah.discord.handle.obj.IMessage) EmbedBuilder(sx.blah.discord.util.EmbedBuilder) IUser(sx.blah.discord.handle.obj.IUser) AbstractGameManager(me.shadorc.shadbot.core.game.AbstractGameManager) UpdateableMessage(me.shadorc.shadbot.utils.object.UpdateableMessage) FormatUtils(me.shadorc.shadbot.utils.FormatUtils) Collectors(java.util.stream.Collectors) MessageListener(me.shadorc.shadbot.message.MessageListener) TimeUnit(java.util.concurrent.TimeUnit) MoneyStatsManager(me.shadorc.shadbot.data.stats.MoneyStatsManager) List(java.util.List) ChronoUnit(java.time.temporal.ChronoUnit) RequestFuture(sx.blah.discord.util.RequestBuffer.RequestFuture) AbstractCommand(me.shadorc.shadbot.core.command.AbstractCommand) Database(me.shadorc.shadbot.data.db.Database) IChannel(sx.blah.discord.handle.obj.IChannel) Difficulty(me.shadorc.shadbot.command.game.hangman.HangmanCmd.Difficulty) RateLimiter(me.shadorc.shadbot.ratelimiter.RateLimiter) Emoji(me.shadorc.shadbot.utils.object.Emoji) EmbedUtils(me.shadorc.shadbot.utils.embed.EmbedUtils) MessageManager(me.shadorc.shadbot.message.MessageManager) EmbedBuilder(sx.blah.discord.util.EmbedBuilder) IMessage(sx.blah.discord.handle.obj.IMessage)

Aggregations

IMessage (sx.blah.discord.handle.obj.IMessage)46 IUser (sx.blah.discord.handle.obj.IUser)10 EmbedBuilder (sx.blah.discord.util.EmbedBuilder)9 EventSubscriber (sx.blah.discord.api.events.EventSubscriber)6 IChannel (sx.blah.discord.handle.obj.IChannel)6 ProfileObject (com.github.vaerys.objects.ProfileObject)5 UserObject (com.github.vaerys.masterobjects.UserObject)4 ArrayList (java.util.ArrayList)4 DiscordException (sx.blah.discord.util.DiscordException)4 Announcement (com.cloudcraftgaming.discal.api.object.announcement.Announcement)3 PreEvent (com.cloudcraftgaming.discal.api.object.event.PreEvent)3 CommandObject (com.github.vaerys.commands.CommandObject)3 SplitFirstObject (com.github.vaerys.objects.SplitFirstObject)3 GitHubImage (io.github.spugn.Sargo.Utilities.GitHubImage)3 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 RateLimitException (sx.blah.discord.util.RateLimitException)3 PreCalendar (com.cloudcraftgaming.discal.api.object.calendar.PreCalendar)2 TrackLikes (com.github.vaerys.objects.TrackLikes)2