From 45e3e3d8be27e013863286e7dbdd069dd2ab0743 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Wed, 12 Oct 2016 19:43:13 +0200 Subject: [PATCH] Fixed $draw, greet mention and .byemsg --- .../Commands/ServerGreetCommands.cs | 4 ++-- .../Modules/Gambling/Commands/DrawCommand.cs | 16 ++++++++-------- .../{8_of_clubs.jpg => eight_of_clubs.jpg} | Bin ...{8_of_diamonds.jpg => eight_of_diamonds.jpg} | Bin .../{8_of_hearts.jpg => eight_of_hearts.jpg} | Bin .../{8_of_spades.jpg => eight_of_spades.jpg} | Bin .../cards/{5_of_clubs.jpg => five_of_clubs.jpg} | Bin .../{5_of_diamonds.jpg => five_of_diamonds.jpg} | Bin .../{5_of_hearts.jpg => five_of_hearts.jpg} | Bin .../{5_of_spades.jpg => five_of_spades.jpg} | Bin .../cards/{4_of_clubs.jpg => four_of_clubs.jpg} | Bin .../{4_of_diamonds.jpg => four_of_diamonds.jpg} | Bin .../{4_of_hearts.jpg => four_of_hearts.jpg} | Bin .../{4_of_spades.jpg => four_of_spades.jpg} | Bin .../cards/{9_of_clubs.jpg => nine_of_clubs.jpg} | Bin .../{9_of_diamonds.jpg => nine_of_diamonds.jpg} | Bin .../{9_of_hearts.jpg => nine_of_hearts.jpg} | Bin .../{9_of_spades.jpg => nine_of_spades.jpg} | Bin .../{7_of_clubs.jpg => seven_of_clubs.jpg} | Bin ...{7_of_diamonds.jpg => seven_of_diamonds.jpg} | Bin .../{7_of_hearts.jpg => seven_of_hearts.jpg} | Bin .../{7_of_spades.jpg => seven_of_spades.jpg} | Bin .../cards/{6_of_clubs.jpg => six_of_clubs.jpg} | Bin .../{6_of_diamonds.jpg => six_of_diamonds.jpg} | Bin .../{6_of_hearts.jpg => six_of_hearts.jpg} | Bin .../{6_of_spades.jpg => six_of_spades.jpg} | Bin .../cards/{10_of_clubs.jpg => ten_of_clubs.jpg} | Bin .../{10_of_diamonds.jpg => ten_of_diamonds.jpg} | Bin .../{10_of_hearts.jpg => ten_of_hearts.jpg} | Bin .../{10_of_spades.jpg => ten_of_spades.jpg} | Bin .../{3_of_clubs.jpg => three_of_clubs.jpg} | Bin ...{3_of_diamonds.jpg => three_of_diamonds.jpg} | Bin .../{3_of_hearts.jpg => three_of_hearts.jpg} | Bin .../{3_of_spades.jpg => three_of_spades.jpg} | Bin .../cards/{2_of_clubs.jpg => two_of_clubs.jpg} | Bin .../{2_of_diamonds.jpg => two_of_diamonds.jpg} | Bin .../{2_of_hearts.jpg => two_of_hearts.jpg} | Bin .../{2_of_spades.jpg => two_of_spades.jpg} | Bin 38 files changed, 10 insertions(+), 10 deletions(-) rename src/NadekoBot/data/images/cards/{8_of_clubs.jpg => eight_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{8_of_diamonds.jpg => eight_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{8_of_hearts.jpg => eight_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{8_of_spades.jpg => eight_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{5_of_clubs.jpg => five_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{5_of_diamonds.jpg => five_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{5_of_hearts.jpg => five_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{5_of_spades.jpg => five_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{4_of_clubs.jpg => four_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{4_of_diamonds.jpg => four_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{4_of_hearts.jpg => four_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{4_of_spades.jpg => four_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{9_of_clubs.jpg => nine_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{9_of_diamonds.jpg => nine_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{9_of_hearts.jpg => nine_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{9_of_spades.jpg => nine_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{7_of_clubs.jpg => seven_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{7_of_diamonds.jpg => seven_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{7_of_hearts.jpg => seven_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{7_of_spades.jpg => seven_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{6_of_clubs.jpg => six_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{6_of_diamonds.jpg => six_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{6_of_hearts.jpg => six_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{6_of_spades.jpg => six_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{10_of_clubs.jpg => ten_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{10_of_diamonds.jpg => ten_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{10_of_hearts.jpg => ten_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{10_of_spades.jpg => ten_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{3_of_clubs.jpg => three_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{3_of_diamonds.jpg => three_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{3_of_hearts.jpg => three_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{3_of_spades.jpg => three_of_spades.jpg} (100%) rename src/NadekoBot/data/images/cards/{2_of_clubs.jpg => two_of_clubs.jpg} (100%) rename src/NadekoBot/data/images/cards/{2_of_diamonds.jpg => two_of_diamonds.jpg} (100%) rename src/NadekoBot/data/images/cards/{2_of_hearts.jpg => two_of_hearts.jpg} (100%) rename src/NadekoBot/data/images/cards/{2_of_spades.jpg => two_of_spades.jpg} (100%) diff --git a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs index 6409e4c0..757ac1e6 100644 --- a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs @@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Administration if (channel == null) //maybe warn the server owner that the channel is missing return; - var msg = conf.ChannelByeMessageText.Replace("%user%", user.Username).Replace("%server%", user.Guild.Name); + var msg = conf.ChannelByeMessageText.Replace("%user%", user.Mention).Replace("%server%", user.Guild.Name); if (string.IsNullOrWhiteSpace(msg)) return; try @@ -284,7 +284,7 @@ namespace NadekoBot.Modules.Administration if (string.IsNullOrWhiteSpace(text)) { - await channel.SendMessageAsync("`Current bye message:` " + conf.ChannelGreetMessageText.SanitizeMentions()); + await channel.SendMessageAsync("`Current bye message:` " + conf.ChannelByeMessageText.SanitizeMentions()); return; } await channel.SendMessageAsync("New bye message set.").ConfigureAwait(false); diff --git a/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs index 1de5650a..a5a20e6e 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs @@ -31,14 +31,13 @@ namespace NadekoBot.Modules.Gambling [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] - public async Task Draw(IUserMessage msg) + public async Task Draw(IUserMessage msg, int num = 1) { var channel = (ITextChannel)msg.Channel; var cards = AllDecks.GetOrAdd(channel.Guild, (s) => new Cards()); - - var num = 1; var images = new List(); var cardObjects = new List(); + if (num > 5) num = 5; for (var i = 0; i < num; i++) { if (cards.CardPool.Count == 0 && i != 0) @@ -48,17 +47,18 @@ namespace NadekoBot.Modules.Gambling } var currentCard = cards.DrawACard(); cardObjects.Add(currentCard); - using (var stream = File.OpenRead(Path.Combine(cardsPath, currentCard.GetName()))) + using (var stream = File.OpenRead(Path.Combine(cardsPath, currentCard.ToString().ToLowerInvariant()+ ".jpg").Replace(' ','_'))) images.Add(new Image(stream)); } MemoryStream bitmapStream = new MemoryStream(); images.Merge().SaveAsPng(bitmapStream); bitmapStream.Position = 0; - await channel.SendFileAsync(bitmapStream, images.Count + " cards.jpg", $"{msg.Author.Mention} drew (TODO: CARD NAMES HERE)").ConfigureAwait(false); + //todo CARD NAMES? + var toSend = $"{msg.Author.Mention}"; if (cardObjects.Count == 5) - { - await channel.SendMessageAsync($"{msg.Author.Mention} `{Cards.GetHandValue(cardObjects)}`").ConfigureAwait(false); - } + toSend += $" drew `{Cards.GetHandValue(cardObjects)}`"; + + await channel.SendFileAsync(bitmapStream, images.Count + " cards.jpg", toSend).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/data/images/cards/8_of_clubs.jpg b/src/NadekoBot/data/images/cards/eight_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/8_of_clubs.jpg rename to src/NadekoBot/data/images/cards/eight_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/8_of_diamonds.jpg b/src/NadekoBot/data/images/cards/eight_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/8_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/eight_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/8_of_hearts.jpg b/src/NadekoBot/data/images/cards/eight_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/8_of_hearts.jpg rename to src/NadekoBot/data/images/cards/eight_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/8_of_spades.jpg b/src/NadekoBot/data/images/cards/eight_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/8_of_spades.jpg rename to src/NadekoBot/data/images/cards/eight_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/5_of_clubs.jpg b/src/NadekoBot/data/images/cards/five_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/5_of_clubs.jpg rename to src/NadekoBot/data/images/cards/five_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/5_of_diamonds.jpg b/src/NadekoBot/data/images/cards/five_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/5_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/five_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/5_of_hearts.jpg b/src/NadekoBot/data/images/cards/five_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/5_of_hearts.jpg rename to src/NadekoBot/data/images/cards/five_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/5_of_spades.jpg b/src/NadekoBot/data/images/cards/five_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/5_of_spades.jpg rename to src/NadekoBot/data/images/cards/five_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/4_of_clubs.jpg b/src/NadekoBot/data/images/cards/four_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/4_of_clubs.jpg rename to src/NadekoBot/data/images/cards/four_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/4_of_diamonds.jpg b/src/NadekoBot/data/images/cards/four_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/4_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/four_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/4_of_hearts.jpg b/src/NadekoBot/data/images/cards/four_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/4_of_hearts.jpg rename to src/NadekoBot/data/images/cards/four_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/4_of_spades.jpg b/src/NadekoBot/data/images/cards/four_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/4_of_spades.jpg rename to src/NadekoBot/data/images/cards/four_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/9_of_clubs.jpg b/src/NadekoBot/data/images/cards/nine_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/9_of_clubs.jpg rename to src/NadekoBot/data/images/cards/nine_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/9_of_diamonds.jpg b/src/NadekoBot/data/images/cards/nine_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/9_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/nine_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/9_of_hearts.jpg b/src/NadekoBot/data/images/cards/nine_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/9_of_hearts.jpg rename to src/NadekoBot/data/images/cards/nine_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/9_of_spades.jpg b/src/NadekoBot/data/images/cards/nine_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/9_of_spades.jpg rename to src/NadekoBot/data/images/cards/nine_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/7_of_clubs.jpg b/src/NadekoBot/data/images/cards/seven_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/7_of_clubs.jpg rename to src/NadekoBot/data/images/cards/seven_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/7_of_diamonds.jpg b/src/NadekoBot/data/images/cards/seven_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/7_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/seven_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/7_of_hearts.jpg b/src/NadekoBot/data/images/cards/seven_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/7_of_hearts.jpg rename to src/NadekoBot/data/images/cards/seven_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/7_of_spades.jpg b/src/NadekoBot/data/images/cards/seven_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/7_of_spades.jpg rename to src/NadekoBot/data/images/cards/seven_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/6_of_clubs.jpg b/src/NadekoBot/data/images/cards/six_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/6_of_clubs.jpg rename to src/NadekoBot/data/images/cards/six_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/6_of_diamonds.jpg b/src/NadekoBot/data/images/cards/six_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/6_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/six_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/6_of_hearts.jpg b/src/NadekoBot/data/images/cards/six_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/6_of_hearts.jpg rename to src/NadekoBot/data/images/cards/six_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/6_of_spades.jpg b/src/NadekoBot/data/images/cards/six_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/6_of_spades.jpg rename to src/NadekoBot/data/images/cards/six_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/10_of_clubs.jpg b/src/NadekoBot/data/images/cards/ten_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/10_of_clubs.jpg rename to src/NadekoBot/data/images/cards/ten_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/10_of_diamonds.jpg b/src/NadekoBot/data/images/cards/ten_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/10_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/ten_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/10_of_hearts.jpg b/src/NadekoBot/data/images/cards/ten_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/10_of_hearts.jpg rename to src/NadekoBot/data/images/cards/ten_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/10_of_spades.jpg b/src/NadekoBot/data/images/cards/ten_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/10_of_spades.jpg rename to src/NadekoBot/data/images/cards/ten_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/3_of_clubs.jpg b/src/NadekoBot/data/images/cards/three_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/3_of_clubs.jpg rename to src/NadekoBot/data/images/cards/three_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/3_of_diamonds.jpg b/src/NadekoBot/data/images/cards/three_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/3_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/three_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/3_of_hearts.jpg b/src/NadekoBot/data/images/cards/three_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/3_of_hearts.jpg rename to src/NadekoBot/data/images/cards/three_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/3_of_spades.jpg b/src/NadekoBot/data/images/cards/three_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/3_of_spades.jpg rename to src/NadekoBot/data/images/cards/three_of_spades.jpg diff --git a/src/NadekoBot/data/images/cards/2_of_clubs.jpg b/src/NadekoBot/data/images/cards/two_of_clubs.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/2_of_clubs.jpg rename to src/NadekoBot/data/images/cards/two_of_clubs.jpg diff --git a/src/NadekoBot/data/images/cards/2_of_diamonds.jpg b/src/NadekoBot/data/images/cards/two_of_diamonds.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/2_of_diamonds.jpg rename to src/NadekoBot/data/images/cards/two_of_diamonds.jpg diff --git a/src/NadekoBot/data/images/cards/2_of_hearts.jpg b/src/NadekoBot/data/images/cards/two_of_hearts.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/2_of_hearts.jpg rename to src/NadekoBot/data/images/cards/two_of_hearts.jpg diff --git a/src/NadekoBot/data/images/cards/2_of_spades.jpg b/src/NadekoBot/data/images/cards/two_of_spades.jpg similarity index 100% rename from src/NadekoBot/data/images/cards/2_of_spades.jpg rename to src/NadekoBot/data/images/cards/two_of_spades.jpg