diff --git a/Discord.Net b/Discord.Net index 9ce5c475..d2229228 160000 --- a/Discord.Net +++ b/Discord.Net @@ -1 +1 @@ -Subproject commit 9ce5c4757efc6cb6bb8959e851abcdcbe03217be +Subproject commit d2229228b92117899d65cd549a1f2853057b255b diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index 40d7776f..3f52ac17 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -440,6 +440,7 @@ namespace NadekoBot.Modules.Administration var enumerable = (await Context.Channel.GetMessagesAsync().Flatten()).AsEnumerable(); enumerable = enumerable.Where(x => x.Author.Id == user.Id); await Context.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false); + Context.Message.DeleteAfter(3); } // prune x @@ -474,6 +475,8 @@ namespace NadekoBot.Modules.Administration int limit = (count < 100) ? count : 100; var enumerable = (await Context.Channel.GetMessagesAsync(limit: limit).Flatten()).Where(m => m.Author == user); await Context.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false); + + Context.Message.DeleteAfter(3); } [NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs b/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs index 78de87e6..39c749d2 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs @@ -28,7 +28,7 @@ namespace NadekoBot.Modules.Gambling var ar = new AnimalRace(Context.Guild.Id, (ITextChannel)Context.Channel, Prefix); if (ar.Fail) - await Context.Channel.SendErrorAsync("๐Ÿ `Failed starting a race. Another race is probably running.`").ConfigureAwait(false); + await ReplyErrorLocalized("race_failed_starting").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Gambling AnimalRace ar; if (!AnimalRaces.TryGetValue(Context.Guild.Id, out ar)) { - await Context.Channel.SendErrorAsync("No race exists on this server").ConfigureAwait(false); + await ReplyErrorLocalized("race_not_exist").ConfigureAwait(false); return; } await ar.JoinRace(Context.User as IGuildUser, amount); @@ -56,22 +56,22 @@ namespace NadekoBot.Modules.Gambling public bool Fail { get; set; } - public List participants = new List(); - private ulong serverId; - private int messagesSinceGameStarted = 0; + private readonly List _participants = new List(); + private readonly ulong _serverId; + private int _messagesSinceGameStarted; private readonly string _prefix; - private Logger _log { get; } + private readonly Logger _log; - public ITextChannel raceChannel { get; set; } - public bool Started { get; private set; } = false; + private readonly ITextChannel _raceChannel; + public bool Started { get; private set; } public AnimalRace(ulong serverId, ITextChannel ch, string prefix) { - this._prefix = prefix; - this._log = LogManager.GetCurrentClassLogger(); - this.serverId = serverId; - this.raceChannel = ch; + _prefix = prefix; + _log = LogManager.GetCurrentClassLogger(); + _serverId = serverId; + _raceChannel = ch; if (!AnimalRaces.TryAdd(serverId, this)) { Fail = true; @@ -90,8 +90,8 @@ namespace NadekoBot.Modules.Gambling { try { - await raceChannel.SendConfirmAsync("Animal Race", $"Starting in 20 seconds or when the room is full.", - footer: $"Type {_prefix}jr to join the race."); + await _raceChannel.SendConfirmAsync(GetText("animal_race"), GetText("animal_race_starting"), + footer: GetText("animal_race_join_instr", _prefix)); } catch (Exception ex) { @@ -102,16 +102,16 @@ namespace NadekoBot.Modules.Gambling cancelSource.Cancel(); if (t == fullgame) { - try { await raceChannel.SendConfirmAsync("Animal Race", "Full! Starting immediately."); } catch (Exception ex) { _log.Warn(ex); } + try { await _raceChannel.SendConfirmAsync(GetText("animal_race"), GetText("animal_race_full") ); } catch (Exception ex) { _log.Warn(ex); } } - else if (participants.Count > 1) + else if (_participants.Count > 1) { - try { await raceChannel.SendConfirmAsync("Animal Race", "Starting with " + participants.Count + " participants."); } catch (Exception ex) { _log.Warn(ex); } + try { await _raceChannel.SendConfirmAsync(GetText("animal_race"), GetText("animal_race_starting_with_x", _participants.Count)); } catch (Exception ex) { _log.Warn(ex); } } else { - try { await raceChannel.SendErrorAsync("Animal Race", "Failed to start since there was not enough participants."); } catch (Exception ex) { _log.Warn(ex); } - var p = participants.FirstOrDefault(); + try { await _raceChannel.SendErrorAsync(GetText("animal_race"), GetText("animal_race_failed")); } catch (Exception ex) { _log.Warn(ex); } + var p = _participants.FirstOrDefault(); if (p != null && p.AmountBet > 0) await CurrencyHandler.AddCurrencyAsync(p.User, "BetRace", p.AmountBet, false).ConfigureAwait(false); @@ -128,7 +128,7 @@ namespace NadekoBot.Modules.Gambling private void End() { AnimalRace throwaway; - AnimalRaces.TryRemove(serverId, out throwaway); + AnimalRaces.TryRemove(_serverId, out throwaway); } private async Task StartRace() @@ -136,21 +136,21 @@ namespace NadekoBot.Modules.Gambling var rng = new NadekoRandom(); Participant winner = null; IUserMessage msg = null; - int place = 1; + var place = 1; try { NadekoBot.Client.MessageReceived += Client_MessageReceived; - while (!participants.All(p => p.Total >= 60)) + while (!_participants.All(p => p.Total >= 60)) { //update the state - participants.ForEach(p => + _participants.ForEach(p => { p.Total += 1 + rng.Next(0, 10); }); - participants + _participants .OrderByDescending(p => p.Total) .ForEach(p => { @@ -170,14 +170,14 @@ namespace NadekoBot.Modules.Gambling //draw the state var text = $@"|๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ”š| -{String.Join("\n", participants.Select(p => $"{(int)(p.Total / 60f * 100),-2}%|{p.ToString()}"))} +{String.Join("\n", _participants.Select(p => $"{(int)(p.Total / 60f * 100),-2}%|{p.ToString()}"))} |๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ๐Ÿ”š|"; - if (msg == null || messagesSinceGameStarted >= 10) // also resend the message if channel was spammed + if (msg == null || _messagesSinceGameStarted >= 10) // also resend the message if channel was spammed { if (msg != null) try { await msg.DeleteAsync(); } catch { } - messagesSinceGameStarted = 0; - try { msg = await raceChannel.SendMessageAsync(text).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } + _messagesSinceGameStarted = 0; + try { msg = await _raceChannel.SendMessageAsync(text).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } } else { @@ -187,22 +187,33 @@ namespace NadekoBot.Modules.Gambling await Task.Delay(2500); } } - catch { } + catch + { + // ignored + } finally { NadekoBot.Client.MessageReceived -= Client_MessageReceived; } - if (winner.AmountBet > 0) + if (winner != null) { - var wonAmount = winner.AmountBet * (participants.Count - 1); + if (winner.AmountBet > 0) + { + var wonAmount = winner.AmountBet * (_participants.Count - 1); - await CurrencyHandler.AddCurrencyAsync(winner.User, "Won a Race", wonAmount, true).ConfigureAwait(false); - await raceChannel.SendConfirmAsync("Animal Race", $"{winner.User.Mention} as {winner.Animal} **Won the race and {wonAmount}{CurrencySign}!**").ConfigureAwait(false); - } - else - { - await raceChannel.SendConfirmAsync("Animal Race", $"{winner.User.Mention} as {winner.Animal} **Won the race!**").ConfigureAwait(false); + await CurrencyHandler.AddCurrencyAsync(winner.User, "Won a Race", wonAmount, true) + .ConfigureAwait(false); + await _raceChannel.SendConfirmAsync(GetText("animal_race"), + Format.Bold(GetText("animal_race_won_money", winner.User.Mention, + winner.Animal, wonAmount + CurrencySign))) + .ConfigureAwait(false); + } + else + { + await _raceChannel.SendConfirmAsync(GetText("animal_race"), + Format.Bold(GetText("animal_race_won", winner.User.Mention, winner.Animal))).ConfigureAwait(false); + } } } @@ -212,9 +223,9 @@ namespace NadekoBot.Modules.Gambling var msg = imsg as SocketUserMessage; if (msg == null) return Task.CompletedTask; - if (msg.IsAuthor() || !(imsg.Channel is ITextChannel) || imsg.Channel != raceChannel) + if (msg.IsAuthor() || !(imsg.Channel is ITextChannel) || imsg.Channel != _raceChannel) return Task.CompletedTask; - messagesSinceGameStarted++; + _messagesSinceGameStarted++; return Task.CompletedTask; } @@ -228,51 +239,66 @@ namespace NadekoBot.Modules.Gambling public async Task JoinRace(IGuildUser u, int amount = 0) { - var animal = ""; + string animal; if (!animals.TryDequeue(out animal)) { - await raceChannel.SendErrorAsync($"{u.Mention} `There is no running race on this server.`").ConfigureAwait(false); + await _raceChannel.SendErrorAsync(GetText("animal_race_no_race")).ConfigureAwait(false); return; } var p = new Participant(u, animal, amount); - if (participants.Contains(p)) + if (_participants.Contains(p)) { - await raceChannel.SendErrorAsync($"{u.Mention} `You already joined this race.`").ConfigureAwait(false); + await _raceChannel.SendErrorAsync(GetText("animal_race_already_in")).ConfigureAwait(false); return; } if (Started) { - await raceChannel.SendErrorAsync($"{u.Mention} `Race is already started`").ConfigureAwait(false); + await _raceChannel.SendErrorAsync(GetText("animal_race_already_started")).ConfigureAwait(false); return; } if (amount > 0) - if (!await CurrencyHandler.RemoveCurrencyAsync((IGuildUser)u, "BetRace", amount, false).ConfigureAwait(false)) + if (!await CurrencyHandler.RemoveCurrencyAsync(u, "BetRace", amount, false).ConfigureAwait(false)) { - try { await raceChannel.SendErrorAsync($"{u.Mention} You don't have enough {NadekoBot.BotConfig.CurrencyPluralName}.").ConfigureAwait(false); } catch { } + await _raceChannel.SendErrorAsync(GetText("not_enough", CurrencySign)).ConfigureAwait(false); return; } - participants.Add(p); - await raceChannel.SendConfirmAsync("Animal Race", $"{u.Mention} **joined as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {CurrencySign}!**" : "**")) - .ConfigureAwait(false); + _participants.Add(p); + string confStr; + if (amount > 0) + confStr = GetText("animal_race_join_bet", u.Mention, p.Animal, amount + CurrencySign); + else + confStr = GetText("animal_race_join", u.Mention, p.Animal); + await _raceChannel.SendConfirmAsync(GetText("animal_race"), Format.Bold(confStr)).ConfigureAwait(false); } + + private string GetText(string text) + => NadekoModule.GetTextStatic(text, + NadekoBot.Localization.GetCultureInfo(_raceChannel.Guild), + typeof(Gambling).Name.ToLowerInvariant()); + + private string GetText(string text, params object[] replacements) + => NadekoModule.GetTextStatic(text, + NadekoBot.Localization.GetCultureInfo(_raceChannel.Guild), + typeof(Gambling).Name.ToLowerInvariant(), + replacements); } public class Participant { - public IGuildUser User { get; set; } - public string Animal { get; set; } - public int AmountBet { get; set; } + public IGuildUser User { get; } + public string Animal { get; } + public int AmountBet { get; } public float Coeff { get; set; } public int Total { get; set; } - public int Place { get; set; } = 0; + public int Place { get; set; } public Participant(IGuildUser u, string a, int amount) { - this.User = u; - this.Animal = a; - this.AmountBet = amount; + User = u; + Animal = a; + AmountBet = amount; } public override int GetHashCode() => User.GetHashCode(); @@ -288,23 +314,13 @@ namespace NadekoBot.Modules.Gambling var str = new string('โ€ฃ', Total) + Animal; if (Place == 0) return str; - if (Place == 1) - { - return str + "๐Ÿ†"; - } - else if (Place == 2) - { - return str + "`2nd`"; - } - else if (Place == 3) - { - return str + "`3rd`"; - } - else - { - return str + $"`{Place}th`"; - } + str += $"`#{Place}`"; + + if (Place == 1) + str += "๐Ÿ†"; + + return str; } } } diff --git a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs index 4bda25a4..a75827e7 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs @@ -22,7 +22,7 @@ namespace NadekoBot.Modules.Gambling private Regex dndRegex { get; } = new Regex(@"^(?\d+)d(?\d+)(?:\+(?\d+))?(?:\-(?\d+))?$", RegexOptions.Compiled); private Regex fudgeRegex { get; } = new Regex(@"^(?\d+)d(?:F|f)$", RegexOptions.Compiled); - private readonly char[] fateRolls = new[] { '-', ' ', '+' }; + private readonly char[] _fateRolls = { '-', ' ', '+' }; [NadekoCommand, Usage, Description, Aliases] public async Task Roll() @@ -40,7 +40,9 @@ namespace NadekoBot.Modules.Gambling return ms; }).ConfigureAwait(false); - await Context.Channel.SendFileAsync(imageStream, "dice.png", $"{Context.User.Mention} rolled " + Format.Code(gen.ToString())).ConfigureAwait(false); + await Context.Channel.SendFileAsync(imageStream, + "dice.png", + Context.User.Mention + " " + GetText("dice_rolled", Format.Code(gen.ToString()))).ConfigureAwait(false); } public enum RollOrderType @@ -82,7 +84,7 @@ namespace NadekoBot.Modules.Gambling { if (num < 1 || num > 30) { - await Context.Channel.SendErrorAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false); + await ReplyErrorLocalized("dice_invalid_number", 1, 30).ConfigureAwait(false); return; } @@ -120,7 +122,12 @@ namespace NadekoBot.Modules.Gambling var ms = new MemoryStream(); bitmap.SaveAsPng(ms); ms.Position = 0; - await Context.Channel.SendFileAsync(ms, "dice.png", $"{Context.User.Mention} rolled {values.Count} {(values.Count == 1 ? "die" : "dice")}. Total: **{values.Sum()}** Average: **{(values.Sum() / (1.0f * values.Count)).ToString("N2")}**").ConfigureAwait(false); + await Context.Channel.SendFileAsync(ms, "dice.png", + Context.User.Mention + + GetText("dice_rolled_num", Format.Bold(values.Count.ToString())) + + " " + GetText("Total: {1} Average: {2}", + Format.Bold(values.Sum().ToString()), + Format.Bold((values.Sum() / (1.0f * values.Count)).ToString("N2")))).ConfigureAwait(false); } private async Task InternallDndRoll(string arg, bool ordered) @@ -138,9 +145,9 @@ namespace NadekoBot.Modules.Gambling for (int i = 0; i < n1; i++) { - rolls.Add(fateRolls[rng.Next(0, fateRolls.Length)]); + rolls.Add(_fateRolls[rng.Next(0, _fateRolls.Length)]); } - var embed = new EmbedBuilder().WithOkColor().WithDescription($"{Context.User.Mention} rolled {n1} fate {(n1 == 1 ? "die" : "dice")}.") + var embed = new EmbedBuilder().WithOkColor().WithDescription(Context.User.Mention + " " + GetText("dice_rolled_num", Format.Bold(n1.ToString()))) .AddField(efb => efb.WithName(Format.Bold("Result")) .WithValue(string.Join(" ", rolls.Select(c => Format.Code($"[{c}]"))))); await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); @@ -164,7 +171,7 @@ namespace NadekoBot.Modules.Gambling } var sum = arr.Sum(); - var embed = new EmbedBuilder().WithOkColor().WithDescription($"{Context.User.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}`") + var embed = new EmbedBuilder().WithOkColor().WithDescription(Context.User.Mention + " " +GetText("dice_rolled_num", n1) + $"`1 - {n2}`") .AddField(efb => efb.WithName(Format.Bold("Rolls")) .WithValue(string.Join(" ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => Format.Code(x.ToString()))))) .AddField(efb => efb.WithName(Format.Bold("Sum")) @@ -177,30 +184,26 @@ namespace NadekoBot.Modules.Gambling [NadekoCommand, Usage, Description, Aliases] public async Task NRoll([Remainder] string range) { - try + int rolled; + if (range.Contains("-")) { - int rolled; - if (range.Contains("-")) + var arr = range.Split('-') + .Take(2) + .Select(int.Parse) + .ToArray(); + if (arr[0] > arr[1]) { - var arr = range.Split('-') - .Take(2) - .Select(int.Parse) - .ToArray(); - if (arr[0] > arr[1]) - throw new ArgumentException("Second argument must be larger than the first one."); - rolled = new NadekoRandom().Next(arr[0], arr[1] + 1); - } - else - { - rolled = new NadekoRandom().Next(0, int.Parse(range) + 1); + await ReplyErrorLocalized("second_larger_than_first").ConfigureAwait(false); + return; } + rolled = new NadekoRandom().Next(arr[0], arr[1] + 1); + } + else + { + rolled = new NadekoRandom().Next(0, int.Parse(range) + 1); + } - await Context.Channel.SendConfirmAsync($"{Context.User.Mention} rolled **{rolled}**.").ConfigureAwait(false); - } - catch (Exception ex) - { - await Context.Channel.SendErrorAsync($":anger: {ex.Message}").ConfigureAwait(false); - } + await ReplyConfirmLocalized("dice_rolled", Format.Bold(rolled.ToString())).ConfigureAwait(false); } private Image GetDice(int num) diff --git a/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs index 6ff7695d..212fd1d2 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/WaifuClaimCommands.cs @@ -3,13 +3,11 @@ using Discord.Commands; using NadekoBot.Attributes; using NadekoBot.Extensions; using NadekoBot.Services; -using NadekoBot.Services.Database; using NadekoBot.Services.Database.Models; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; namespace NadekoBot.Modules.Gambling @@ -49,8 +47,8 @@ namespace NadekoBot.Modules.Gambling [Group] public class WaifuClaimCommands : NadekoSubmodule { - private static ConcurrentDictionary _divorceCooldowns { get; } = new ConcurrentDictionary(); - private static ConcurrentDictionary _affinityCooldowns { get; } = new ConcurrentDictionary(); + private static ConcurrentDictionary divorceCooldowns { get; } = new ConcurrentDictionary(); + private static ConcurrentDictionary affinityCooldowns { get; } = new ConcurrentDictionary(); enum WaifuClaimResult { @@ -65,20 +63,19 @@ namespace NadekoBot.Modules.Gambling { if (amount < 50) { - await Context.Channel.SendErrorAsync($"{Context.User.Mention} No waifu is that cheap. You must pay at least 50{NadekoBot.BotConfig.CurrencySign} to get a waifu, even if their actual value is lower.").ConfigureAwait(false); + await ReplyErrorLocalized("waifu_isnt_cheap", 50 + CurrencySign).ConfigureAwait(false); return; } if (target.Id == Context.User.Id) { - await Context.Channel.SendErrorAsync(Context.User.Mention + " You can't claim yourself.").ConfigureAwait(false); + await ReplyErrorLocalized("waifu_not_yourself").ConfigureAwait(false); return; } - WaifuClaimResult result = WaifuClaimResult.NotEnoughFunds; - int? oldPrice = null; + WaifuClaimResult result; WaifuInfo w; - var isAffinity = false; + bool isAffinity; using (var uow = DbHandler.UnitOfWork()) { w = uow.Waifus.ByWaifuUserId(target.Id); @@ -120,7 +117,6 @@ namespace NadekoBot.Modules.Gambling { var oldClaimer = w.Claimer; w.Claimer = uow.DiscordUsers.GetOrCreate(Context.User); - oldPrice = w.Price; w.Price = amount + (amount / 4); result = WaifuClaimResult.Success; @@ -143,7 +139,6 @@ namespace NadekoBot.Modules.Gambling { var oldClaimer = w.Claimer; w.Claimer = uow.DiscordUsers.GetOrCreate(Context.User); - oldPrice = w.Price; w.Price = amount; result = WaifuClaimResult.Success; @@ -165,22 +160,20 @@ namespace NadekoBot.Modules.Gambling if (result == WaifuClaimResult.InsufficientAmount) { - await Context.Channel.SendErrorAsync($"{Context.User.Mention} You must pay {Math.Ceiling(w.Price * (isAffinity ? 0.88f : 1.1f))} or more to claim that waifu!").ConfigureAwait(false); + await ReplyErrorLocalized("waifu_not_enough", Math.Ceiling(w.Price * (isAffinity ? 0.88f : 1.1f))).ConfigureAwait(false); return; } - else if (result == WaifuClaimResult.NotEnoughFunds) + if (result == WaifuClaimResult.NotEnoughFunds) { - await Context.Channel.SendConfirmAsync($"{Context.User.Mention} you don't have {amount}{NadekoBot.BotConfig.CurrencySign}!") - .ConfigureAwait(false); - } - else - { - var msg = $"{Context.User.Mention} claimed {target.Mention} as their waifu for {amount}{NadekoBot.BotConfig.CurrencySign}!"; - if (w.Affinity?.UserId == Context.User.Id) - msg += $"\n๐ŸŽ‰ Their love is fulfilled! ๐ŸŽ‰\n**{target}'s** new value is {w.Price}{NadekoBot.BotConfig.CurrencySign}!"; - await Context.Channel.SendConfirmAsync(msg) - .ConfigureAwait(false); + await ReplyErrorLocalized("not_enough", CurrencySign).ConfigureAwait(false); + return; } + var msg = GetText("waifu_claimed", + Format.Bold(target.ToString()), + amount + CurrencySign); + if (w.Affinity?.UserId == Context.User.Id) + msg += "\n" + GetText("waifu_fulfilled", target, w.Price + CurrencySign); + await Context.Channel.SendConfirmAsync(Context.User.Mention + msg).ConfigureAwait(false); } public enum DivorceResult @@ -192,7 +185,7 @@ namespace NadekoBot.Modules.Gambling } - private static readonly TimeSpan DivorceLimit = TimeSpan.FromHours(6); + private static readonly TimeSpan _divorceLimit = TimeSpan.FromHours(6); [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task Divorce([Remainder]IUser target) @@ -200,19 +193,19 @@ namespace NadekoBot.Modules.Gambling if (target.Id == Context.User.Id) return; - var result = DivorceResult.NotYourWife; - TimeSpan difference = TimeSpan.Zero; + DivorceResult result; + var difference = TimeSpan.Zero; var amount = 0; WaifuInfo w = null; using (var uow = DbHandler.UnitOfWork()) { w = uow.Waifus.ByWaifuUserId(target.Id); var now = DateTime.UtcNow; - if (w == null || w.Claimer == null || w.Claimer.UserId != Context.User.Id) + if (w?.Claimer == null || w.Claimer.UserId != Context.User.Id) result = DivorceResult.NotYourWife; - else if (_divorceCooldowns.AddOrUpdate(Context.User.Id, + else if (divorceCooldowns.AddOrUpdate(Context.User.Id, now, - (key, old) => ((difference = now.Subtract(old)) > DivorceLimit) ? now : old) != now) + (key, old) => ((difference = now.Subtract(old)) > _divorceLimit) ? now : old) != now) { result = DivorceResult.Cooldown; } @@ -249,37 +242,39 @@ namespace NadekoBot.Modules.Gambling if (result == DivorceResult.SucessWithPenalty) { - await Context.Channel.SendConfirmAsync($"{Context.User.Mention} You have divorced a waifu who likes you. You heartless monster.\n{w.Waifu} received {amount}{NadekoBot.BotConfig.CurrencySign} as a compensation.").ConfigureAwait(false); + await ReplyConfirmLocalized("waifu_divorced_like", Format.Bold(w.Waifu.ToString()), amount + CurrencySign).ConfigureAwait(false); } else if (result == DivorceResult.Success) { - await Context.Channel.SendConfirmAsync($"{Context.User.Mention} You have divorced a waifu who doesn't like you. You received {amount}{NadekoBot.BotConfig.CurrencySign} back.").ConfigureAwait(false); + await ReplyConfirmLocalized("waifu_divorced_notlike", amount + CurrencySign).ConfigureAwait(false); } else if (result == DivorceResult.NotYourWife) { - await Context.Channel.SendErrorAsync($"{Context.User.Mention} That waifu is not yours.").ConfigureAwait(false); + await ReplyErrorLocalized("waifu_not_yours").ConfigureAwait(false); } else { - var remaining = DivorceLimit.Subtract(difference); - await Context.Channel.SendErrorAsync($"{Context.User.Mention} You divorced recently. You must wait **{remaining.Hours} hours and {remaining.Minutes} minutes** to divorce again.").ConfigureAwait(false); + var remaining = _divorceLimit.Subtract(difference); + await ReplyErrorLocalized("waifu_recent_divorce", + Format.Bold(((int)remaining.TotalHours).ToString()), + Format.Bold(remaining.Minutes.ToString())).ConfigureAwait(false); } } - private static readonly TimeSpan AffinityLimit = TimeSpan.FromMinutes(30); + private static readonly TimeSpan _affinityLimit = TimeSpan.FromMinutes(30); [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task WaifuClaimerAffinity([Remainder]IUser u = null) { if (u?.Id == Context.User.Id) { - await Context.Channel.SendErrorAsync($"{Context.User.Mention} you can't set affinity to yourself, you egomaniac.").ConfigureAwait(false); + await ReplyErrorLocalized("waifu_egomaniac").ConfigureAwait(false); return; } DiscordUser oldAff = null; var sucess = false; var cooldown = false; - TimeSpan difference = TimeSpan.Zero; + var difference = TimeSpan.Zero; using (var uow = DbHandler.UnitOfWork()) { var w = uow.Waifus.ByWaifuUserId(Context.User.Id); @@ -287,13 +282,11 @@ namespace NadekoBot.Modules.Gambling var now = DateTime.UtcNow; if (w?.Affinity?.UserId == u?.Id) { - sucess = false; } - else if (_affinityCooldowns.AddOrUpdate(Context.User.Id, + else if (affinityCooldowns.AddOrUpdate(Context.User.Id, now, - (key, old) => ((difference = now.Subtract(old)) > AffinityLimit) ? now : old) != now) + (key, old) => ((difference = now.Subtract(old)) > _affinityLimit) ? now : old) != now) { - sucess = false; cooldown = true; } else if (w == null) @@ -338,19 +331,29 @@ namespace NadekoBot.Modules.Gambling { if (cooldown) { - var remaining = AffinityLimit.Subtract(difference); - await Context.Channel.SendErrorAsync($"{Context.User.Mention} You must wait **{remaining.Hours} hours and {remaining.Minutes} minutes** in order to change your affinity again.").ConfigureAwait(false); + var remaining = _affinityLimit.Subtract(difference); + await ReplyErrorLocalized("waifu_affinity_cooldown", + Format.Bold(((int)remaining.TotalHours).ToString()), + Format.Bold(remaining.Minutes.ToString())).ConfigureAwait(false); } else - await Context.Channel.SendErrorAsync($"{Context.User.Mention} your affinity is already set to that waifu or you're trying to remove your affinity while not having one.").ConfigureAwait(false); + { + await ReplyErrorLocalized("waifu_affinity_already").ConfigureAwait(false); + } return; } if (u == null) - await Context.Channel.SendConfirmAsync("Affinity Reset", $"{Context.User.Mention} Your affinity is reset. You no longer have a person you like.").ConfigureAwait(false); + { + await ReplyConfirmLocalized("waifu_affinity_reset").ConfigureAwait(false); + } else if (oldAff == null) - await Context.Channel.SendConfirmAsync("Affinity Set", $"{Context.User.Mention} wants to be {u.Mention}'s waifu. Aww <3").ConfigureAwait(false); + { + await ReplyConfirmLocalized("waifu_affinity_set", Format.Bold(u.ToString())).ConfigureAwait(false); + } else - await Context.Channel.SendConfirmAsync("Affinity Changed", $"{Context.User.Mention} changed their affinity from {oldAff} to {u.Mention}.\n\n*This is morally questionable.*๐Ÿค”").ConfigureAwait(false); + { + await ReplyConfirmLocalized("waifu_affinity_changed", Format.Bold(oldAff.ToString()), Format.Bold(u.ToString())).ConfigureAwait(false); + } } [NadekoCommand, Usage, Description, Aliases] @@ -365,19 +368,20 @@ namespace NadekoBot.Modules.Gambling if (waifus.Count == 0) { - await Context.Channel.SendConfirmAsync("No waifus have been claimed yet.").ConfigureAwait(false); + await ReplyConfirmLocalized("waifu_none").ConfigureAwait(false); return; } - + var embed = new EmbedBuilder() - .WithTitle("Top Waifus") + .WithTitle(GetText("waifus_top_waifus")) .WithOkColor(); - for (int i = 0; i < waifus.Count; i++) + for (var i = 0; i < waifus.Count; i++) { var w = waifus[i]; - embed.AddField(efb => efb.WithName("#" + (i + 1) + " - " + w.Price + NadekoBot.BotConfig.CurrencySign).WithValue(w.ToString()).WithIsInline(false)); + var j = i; + embed.AddField(efb => efb.WithName("#" + (j + 1) + " - " + w.Price + NadekoBot.BotConfig.CurrencySign).WithValue(w.ToString()).WithIsInline(false)); } await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); @@ -419,15 +423,16 @@ namespace NadekoBot.Modules.Gambling var claimInfo = GetClaimTitle(target.Id); var affInfo = GetAffinityTitle(target.Id); + var nobody = GetText("nobody"); var embed = new EmbedBuilder() .WithOkColor() .WithTitle("Waifu " + w.Waifu + " - \"the " + claimInfo.Title + "\"") - .AddField(efb => efb.WithName("Price").WithValue(w.Price.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName("Claimed by").WithValue(w.Claimer?.ToString() ?? "No one").WithIsInline(true)) - .AddField(efb => efb.WithName("Likes").WithValue(w.Affinity?.ToString() ?? "Nobody").WithIsInline(true)) - .AddField(efb => efb.WithName("Changes Of Heart").WithValue($"{affInfo.Count} - \"the {affInfo.Title}\"").WithIsInline(true)) - .AddField(efb => efb.WithName("Divorces").WithValue(divorces.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName($"Waifus ({claims.Count})").WithValue(claims.Count == 0 ? "Nobody" : string.Join("\n", claims.Select(x => x.Waifu))).WithIsInline(true)); + .AddField(efb => efb.WithName(GetText("price")).WithValue(w.Price.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName(GetText("claimed_by")).WithValue(w.Claimer?.ToString() ?? nobody).WithIsInline(true)) + .AddField(efb => efb.WithName(GetText("likes")).WithValue(w.Affinity?.ToString() ?? nobody).WithIsInline(true)) + .AddField(efb => efb.WithName(GetText("changes_of_heart")).WithValue($"{affInfo.Count} - \"the {affInfo.Title}\"").WithIsInline(true)) + .AddField(efb => efb.WithName(GetText("divorces")).WithValue(divorces.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName($"Waifus ({claims.Count})").WithValue(claims.Count == 0 ? nobody : string.Join("\n", claims.Select(x => x.Waifu))).WithIsInline(true)); await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -447,13 +452,13 @@ namespace NadekoBot.Modules.Gambling private static WaifuProfileTitle GetClaimTitle(ulong userId) { - int count = 0; + int count; using (var uow = DbHandler.UnitOfWork()) { count = uow.Waifus.ByClaimerUserId(userId).Count; } - ClaimTitles title = ClaimTitles.Lonely; + ClaimTitles title; if (count == 0) title = ClaimTitles.Lonely; else if (count == 1) @@ -484,13 +489,13 @@ namespace NadekoBot.Modules.Gambling private static WaifuProfileTitle GetAffinityTitle(ulong userId) { - int count = 0; + int count; using (var uow = DbHandler.UnitOfWork()) { count = uow._context.WaifuUpdates.Count(w => w.User.UserId == userId && w.UpdateType == WaifuUpdateType.AffinityChanged); } - AffinityTitles title = AffinityTitles.Pure; + AffinityTitles title; if (count < 1) title = AffinityTitles.Pure; else if (count < 2) diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index acceab4e..3cdd7165 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -240,9 +240,7 @@ namespace NadekoBot.Modules.Gambling (int) (amount * NadekoBot.BotConfig.Betroll100Multiplier), false).ConfigureAwait(false); } } - Console.WriteLine("started sending"); await Context.Channel.SendConfirmAsync(str).ConfigureAwait(false); - Console.WriteLine("done sending"); } [NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Modules/Games/Commands/Acropobia.cs b/src/NadekoBot/Modules/Games/Commands/Acropobia.cs index ff0cc725..1ee7adbd 100644 --- a/src/NadekoBot/Modules/Games/Commands/Acropobia.cs +++ b/src/NadekoBot/Modules/Games/Commands/Acropobia.cs @@ -28,6 +28,8 @@ namespace NadekoBot.Modules.Games [RequireContext(ContextType.Guild)] public async Task Acro(int time = 60) { + if (time < 10 || time > 120) + return; var channel = (ITextChannel)Context.Channel; var game = new AcrophobiaGame(channel, time); diff --git a/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs b/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs index a025eb0d..b4b18e97 100644 --- a/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs +++ b/src/NadekoBot/Modules/Games/Commands/Hangman/HangmanGame.cs @@ -9,8 +9,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using NadekoBot.Modules.Games.Commands.Hangman; -namespace NadekoBot.Modules.Games.Commands.Hangman +namespace NadekoBot.Modules.Games.Hangman { public class HangmanTermPool { @@ -70,7 +71,7 @@ namespace NadekoBot.Modules.Games.Commands.Hangman return $" {c}"; c = char.ToUpperInvariant(c); - return Guesses.Contains(c) ? $" {c}" : " _"; + return Guesses.Contains(c) ? $" {c}" : " โ—ฏ"; })) + "`"; public bool GuessedAll => Guesses.IsSupersetOf(Term.Word.ToUpperInvariant() @@ -145,7 +146,7 @@ namespace NadekoBot.Modules.Games.Commands.Hangman MessagesSinceLastPost = 0; ++Errors; if (Errors < MaxErrors) - await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author.Mention} Letter `{guess}` has already been used.\n" + ScrambledWord + "\n" + GetHangman(), + await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author} Letter `{guess}` has already been used.\n" + ScrambledWord + "\n" + GetHangman(), footer: string.Join(" ", Guesses)).ConfigureAwait(false); else await End().ConfigureAwait(false); @@ -158,7 +159,7 @@ namespace NadekoBot.Modules.Games.Commands.Hangman { if (GuessedAll) { - try { await GameChannel.SendConfirmAsync("Hangman Game", $"{msg.Author.Mention} guessed a letter `{guess}`!").ConfigureAwait(false); } catch { } + try { await GameChannel.SendConfirmAsync("Hangman Game", $"{msg.Author} guessed a letter `{guess}`!").ConfigureAwait(false); } catch { } await End().ConfigureAwait(false); return; @@ -166,7 +167,7 @@ namespace NadekoBot.Modules.Games.Commands.Hangman MessagesSinceLastPost = 0; try { - await GameChannel.SendConfirmAsync("Hangman Game", $"{msg.Author.Mention} guessed a letter `{guess}`!\n" + ScrambledWord + "\n" + GetHangman(), + await GameChannel.SendConfirmAsync("Hangman Game", $"{msg.Author} guessed a letter `{guess}`!\n" + ScrambledWord + "\n" + GetHangman(), footer: string.Join(" ", Guesses)).ConfigureAwait(false); } catch { } @@ -177,7 +178,7 @@ namespace NadekoBot.Modules.Games.Commands.Hangman MessagesSinceLastPost = 0; ++Errors; if (Errors < MaxErrors) - await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author.Mention} Letter `{guess}` does not exist.\n" + ScrambledWord + "\n" + GetHangman(), + await GameChannel.SendErrorAsync("Hangman Game", $"{msg.Author} Letter `{guess}` does not exist.\n" + ScrambledWord + "\n" + GetHangman(), footer: string.Join(" ", Guesses)).ConfigureAwait(false); else await End().ConfigureAwait(false); diff --git a/src/NadekoBot/Modules/Games/Commands/HangmanCommands.cs b/src/NadekoBot/Modules/Games/Commands/HangmanCommands.cs index 83637a62..f3f09da0 100644 --- a/src/NadekoBot/Modules/Games/Commands/HangmanCommands.cs +++ b/src/NadekoBot/Modules/Games/Commands/HangmanCommands.cs @@ -6,6 +6,7 @@ using NLog; using System; using System.Collections.Concurrent; using System.Threading.Tasks; +using NadekoBot.Modules.Games.Hangman; namespace NadekoBot.Modules.Games { diff --git a/src/NadekoBot/Modules/Games/Games.cs b/src/NadekoBot/Modules/Games/Games.cs index b10869b8..9c67460f 100644 --- a/src/NadekoBot/Modules/Games/Games.cs +++ b/src/NadekoBot/Modules/Games/Games.cs @@ -45,10 +45,9 @@ namespace NadekoBot.Modules.Games { if (p == 0) return "๐Ÿš€"; - else if (p == 1) + if (p == 1) return "๐Ÿ“Ž"; - else - return "โœ‚๏ธ"; + return "โœ‚๏ธ"; }; int pick; diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index 670980ea..28a00413 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -127,7 +127,7 @@ namespace NadekoBot.Modules.Searches .WithIconUrl("http://i.imgur.com/G46fm8J.png")) .WithDescription(res.Link) .WithImageUrl(res.Link) - .WithTitle(Context.User.Mention); + .WithTitle(Context.User.ToString()); await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); } catch @@ -157,7 +157,7 @@ namespace NadekoBot.Modules.Searches .WithIconUrl("http://s.imgur.com/images/logo-1200-630.jpg?")) .WithDescription(source) .WithImageUrl(source) - .WithTitle(Context.User.Mention); + .WithTitle(Context.User.ToString()); await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); } } @@ -179,7 +179,7 @@ namespace NadekoBot.Modules.Searches .WithIconUrl("http://i.imgur.com/G46fm8J.png")) .WithDescription(res.Link) .WithImageUrl(res.Link) - .WithTitle(Context.User.Mention); + .WithTitle(Context.User.ToString()); await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); } catch @@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Searches .WithIconUrl("http://s.imgur.com/images/logo-1200-630.jpg?")) .WithDescription(source) .WithImageUrl(source) - .WithTitle(Context.User.Mention); + .WithTitle(Context.User.ToString()); await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); } } diff --git a/src/NadekoBot/Resources/ResponseStrings.Designer.cs b/src/NadekoBot/Resources/ResponseStrings.Designer.cs index 78867fa4..6e3c725a 100644 --- a/src/NadekoBot/Resources/ResponseStrings.Designer.cs +++ b/src/NadekoBot/Resources/ResponseStrings.Designer.cs @@ -2072,6 +2072,96 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Animal Race. + /// + public static string gambling_animal_race { + get { + return ResourceManager.GetString("gambling_animal_race", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed to start since there was not enough participants.. + /// + public static string gambling_animal_race_failed { + get { + return ResourceManager.GetString("gambling_animal_race_failed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Race is full! Starting immediately.. + /// + public static string gambling_animal_race_full { + get { + return ResourceManager.GetString("gambling_animal_race_full", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} joined as a {1}. + /// + public static string gambling_animal_race_join { + get { + return ResourceManager.GetString("gambling_animal_race_join", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} joined as a {1} and bet {2}!. + /// + public static string gambling_animal_race_join_bet { + get { + return ResourceManager.GetString("gambling_animal_race_join_bet", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type {0}jr to join the race.. + /// + public static string gambling_animal_race_join_instr { + get { + return ResourceManager.GetString("gambling_animal_race_join_instr", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting in 20 seconds or when the room is full.. + /// + public static string gambling_animal_race_starting { + get { + return ResourceManager.GetString("gambling_animal_race_starting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Starting with {0} participants.. + /// + public static string gambling_animal_race_starting_with_x { + get { + return ResourceManager.GetString("gambling_animal_race_starting_with_x", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} as {1} Won the race!. + /// + public static string gambling_animal_race_won { + get { + return ResourceManager.GetString("gambling_animal_race_won", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} as {1} Won the race and {2}!. + /// + public static string gambling_animal_race_won_money { + get { + return ResourceManager.GetString("gambling_animal_race_won_money", resourceCulture); + } + } + /// /// Looks up a localized string similar to has awarded {0} to {1}. /// @@ -2108,6 +2198,24 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Changes Of Heart. + /// + public static string gambling_changes_of_heart { + get { + return ResourceManager.GetString("gambling_changes_of_heart", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Claimed By. + /// + public static string gambling_claimed_by { + get { + return ResourceManager.GetString("gambling_claimed_by", resourceCulture); + } + } + /// /// Looks up a localized string similar to Deck reshuffled.. /// @@ -2117,6 +2225,42 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Invalid number specified. You can roll up to {0}-{1} dice at a time.. + /// + public static string gambling_dice_invalid_number { + get { + return ResourceManager.GetString("gambling_dice_invalid_number", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to rolled {0}. + /// + public static string gambling_dice_rolled { + get { + return ResourceManager.GetString("gambling_dice_rolled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Dice rolled: {1}. + /// + public static string gambling_dice_rolled_num { + get { + return ResourceManager.GetString("gambling_dice_rolled_num", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Divorces. + /// + public static string gambling_divorces { + get { + return ResourceManager.GetString("gambling_divorces", resourceCulture); + } + } + /// /// Looks up a localized string similar to You guessed it! You won {0}. /// @@ -2207,6 +2351,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Likes. + /// + public static string gambling_likes { + get { + return ResourceManager.GetString("gambling_likes", resourceCulture); + } + } + /// /// Looks up a localized string similar to Awarded {0} to {1} users from {2} role.. /// @@ -2243,6 +2396,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Nobody. + /// + public static string gambling_nobody { + get { + return ResourceManager.GetString("gambling_nobody", resourceCulture); + } + } + /// /// Looks up a localized string similar to You don't have enough {0}. /// @@ -2252,6 +2414,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Price. + /// + public static string gambling_price { + get { + return ResourceManager.GetString("gambling_price", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Failed starting the race. Another race is probably running.. + /// + public static string gambling_race_failed_starting { + get { + return ResourceManager.GetString("gambling_race_failed_starting", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No race exists on this server. + /// + public static string gambling_race_not_exist { + get { + return ResourceManager.GetString("gambling_race_not_exist", resourceCulture); + } + } + /// /// Looks up a localized string similar to Raffled User. /// @@ -2270,6 +2459,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Second number must be larger than the first one.. + /// + public static string gambling_second_larger_than_first { + get { + return ResourceManager.GetString("gambling_second_larger_than_first", resourceCulture); + } + } + /// /// Looks up a localized string similar to Bet. /// @@ -2379,6 +2577,163 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to your affinity is already set to that waifu or you're trying to remove your affinity while not having one.. + /// + public static string gambling_waifu_affinity_already { + get { + return ResourceManager.GetString("gambling_waifu_affinity_already", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to changed their affinity from {0} to {1}. + /// + ///*This is morally questionable.*๐Ÿค”. + /// + public static string gambling_waifu_affinity_changed { + get { + return ResourceManager.GetString("gambling_waifu_affinity_changed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must wait {0} hours and {1} minutes in order to change your affinity again.. + /// + public static string gambling_waifu_affinity_cooldown { + get { + return ResourceManager.GetString("gambling_waifu_affinity_cooldown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your affinity is reset. You no longer have a person you like.. + /// + public static string gambling_waifu_affinity_reset { + get { + return ResourceManager.GetString("gambling_waifu_affinity_reset", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to wants to be {0}'s waifu. Aww <3. + /// + public static string gambling_waifu_affinity_set { + get { + return ResourceManager.GetString("gambling_waifu_affinity_set", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to claimed {0} as their waifu for {1}!. + /// + public static string gambling_waifu_claimed { + get { + return ResourceManager.GetString("gambling_waifu_claimed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You have divorced a waifu who likes you. You heartless monster. + ///{0} received {1} as a compensation.. + /// + public static string gambling_waifu_divorced_like { + get { + return ResourceManager.GetString("gambling_waifu_divorced_like", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You have divorced a waifu who doesn't like you. You received {0} back.. + /// + public static string gambling_waifu_divorced_not_like { + get { + return ResourceManager.GetString("gambling_waifu_divorced_not_like", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to you can't set affinity to yourself, you egomaniac.. + /// + public static string gambling_waifu_egomaniac { + get { + return ResourceManager.GetString("gambling_waifu_egomaniac", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ๐ŸŽ‰ Their love is fulfilled! ๐ŸŽ‰ + ///{0}'s new value is {1}!. + /// + public static string gambling_waifu_fulfilled { + get { + return ResourceManager.GetString("gambling_waifu_fulfilled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No waifu is that cheap. You must pay at least {0} to get a waifu, even if their actual value is lower.. + /// + public static string gambling_waifu_isnt_cheap { + get { + return ResourceManager.GetString("gambling_waifu_isnt_cheap", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You must pay {0} or more to claim that waifu!. + /// + public static string gambling_waifu_not_enough { + get { + return ResourceManager.GetString("gambling_waifu_not_enough", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to That waifu is not yours.. + /// + public static string gambling_waifu_not_yours { + get { + return ResourceManager.GetString("gambling_waifu_not_yours", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You can't claim yourself.. + /// + public static string gambling_waifu_not_yourself { + get { + return ResourceManager.GetString("gambling_waifu_not_yourself", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You divorced recently. You must wait {0} hours and {1} minutes to divorce again.. + /// + public static string gambling_waifu_recent_divorce { + get { + return ResourceManager.GetString("gambling_waifu_recent_divorce", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No waifus have been claimed yet.. + /// + public static string gambling_waifus_none { + get { + return ResourceManager.GetString("gambling_waifus_none", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Top Waifus. + /// + public static string gambling_waifus_top_waifus { + get { + return ResourceManager.GetString("gambling_waifus_top_waifus", resourceCulture); + } + } + /// /// Looks up a localized string similar to Back to ToC. /// diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index 1afc5b8b..4db9ff76 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -1043,4 +1043,125 @@ Don't forget to leave your discord name or id in the message. Tag + + Animal Race + + + Failed to start since there was not enough participants. + + + Race is full! Starting immediately. + + + {0} joined as a {1} + + + {0} joined as a {1} and bet {2}! + + + Type {0}jr to join the race. + + + Starting in 20 seconds or when the room is full. + + + Starting with {0} participants. + + + {0} as {1} Won the race! + + + {0} as {1} Won the race and {2}! + + + Invalid number specified. You can roll up to {0}-{1} dice at a time. + + + rolled {0} + Someone rolled 35 + + + Dice rolled: {1} + Dice Rolled: 5 + + + Failed starting the race. Another race is probably running. + + + No race exists on this server + + + Second number must be larger than the first one. + + + Changes Of Heart + + + Claimed By + + + Divorces + + + Likes + + + Price + + + No waifus have been claimed yet. + + + Top Waifus + + + your affinity is already set to that waifu or you're trying to remove your affinity while not having one. + + + changed their affinity from {0} to {1}. + +*This is morally questionable.*๐Ÿค” + Make sure to get the formatting right, and leave the thinking emoji + + + You must wait {0} hours and {1} minutes in order to change your affinity again. + + + Your affinity is reset. You no longer have a person you like. + + + wants to be {0}'s waifu. Aww <3 + + + claimed {0} as their waifu for {1}! + + + You have divorced a waifu who likes you. You heartless monster. +{0} received {1} as a compensation. + + + You have divorced a waifu who doesn't like you. You received {0} back. + + + you can't set affinity to yourself, you egomaniac. + + + ๐ŸŽ‰ Their love is fulfilled! ๐ŸŽ‰ +{0}'s new value is {1}! + + + No waifu is that cheap. You must pay at least {0} to get a waifu, even if their actual value is lower. + + + You must pay {0} or more to claim that waifu! + + + That waifu is not yours. + + + You can't claim yourself. + + + You divorced recently. You must wait {0} hours and {1} minutes to divorce again. + \ No newline at end of file diff --git a/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx b/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx index 86b7aa87..8d58263b 100644 --- a/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx +++ b/src/NadekoBot/Resources/ResponseStrings.sr-cyrl-rs.resx @@ -250,9 +250,6 @@ ะ ะฐั‚ ะฟั€ะพั‚ะธะฒ {0} ั˜ะต ะทะฐะฟะพั‡ะตั‚! - - ั˜ะต **ะฃะะ˜ะจะขะ˜ะž** ะฑะฐะทัƒ #{0} ัƒ ั€ะฐั‚ัƒ ะฟั€ะพั‚ะธะฒ {1} - ะกะฒะฐ ัั‚ะฐั‚ะธัั‚ะธะบะฐ ะ ะตะฐะบั†ะธั˜ะฐ ะฟะพ ะ˜ะทะฑะพั€ัƒ ั˜ะต ะพะฑั€ะธัะฐะฝะฐ. @@ -359,10 +356,691 @@ ะัƒั‚ะพะฅะตะฝั‚ะฐะธ ะทะฐัƒัั‚ะฐะฒั™ะตะฝ. - - ะะตะผะฐ ั€ะตะทัƒะปั‚ะฐั‚ะฐ. - ะขะฐะณ + + **DESTROYED** base #{0} in a war against {1} + + + No results found. + + + **Auto assign role** on user join is now **disabled**. + + + **Auto assign role** on user join is now **enabled**. + + + Attachments + + + Avatar Changed + + + You have been banned from {0} server. +Reason: {1} + + + banned + PLURAL + + + User Banned + + + Bot name changed to {0} + + + Bot status changed to {0} + + + Automatic deletion of bye messages has been disabled. + + + Bye messages will be deleted after {0} seconds. + + + Current bye message: {0} + + + Enable bye messages by typing {0} + + + New bye message set. + + + Bye announcements disabled. + + + Bye announcements enabled on this channel. + + + Channel Name Changed + + + Old Name + + + Channel Topic Changed + + + Cleaned up. + + + Content + + + Sucessfully created role {0} + + + Text channel {0} created. + + + Voice channel {0} created. + + + Deafen successful. + + + Deleted server {0} + + + Stopped automatic deletion of successful command invokations. + + + Now automatically deleting sucessful command invokations. + + + Text channel {0} deleted. + + + Voice channel {0} deleted. + + + DM from + + + Sucessfully added a new donator.Total donated amount from this user: {0} ๐Ÿ‘‘ + + + Thanks to the people listed below for making this project hjappen! + + + I will forward DMs to all owners. + + + I will forward DMs only to the first owner. + + + I will forward DMs from now on. + + + I will stop forwarding DMs from now on. + + + Automatic deletion of greet messages has been disabled. + + + Greet messages will be deleted after {0} seconds. + + + Current DM greet message: {0} + + + Enable DM greet messages by typing {0} + + + New DM greet message set. + + + DM greet announcements disabled. + + + DM greet announcements enabled. + + + Current greet message: {0} + + + Enable greet messages by typing {0} + + + New greet message set. + + + Greet announcements disabled. + + + Greet announcements enabled on this channel. + + + You can't use this command on users with a role higher or equal to yours in the role hierarchy. + + + Images loaded after {0} seconds! + + + Invalid input format. + + + Invalid parameters. + + + {0} has joined {1} + + + You have been kicked from {0} server. +Reason: {1} + + + User Kicked + + + List Of Languages +{0} + + + Your server's locale is now {0} - {1} + + + Bot's default locale is now {0} - {1} + + + Bot's language is set to {0} - {0} + + + Failed setting locale. Revisit this command's help. + + + This server's language is set to {0} - {0} + + + {0} has left {1} + + + Left server {0} + + + Logging {0} event in this channel. + + + Logging all events in this channel. + + + Logging disabled. + + + Log events you can subscribe to: + + + Logging will ignore {0} + + + Logging will not ignore {0} + + + Stopped logging {0} event. + + + {0} has invoked a mention on the following roles + + + Message from {0} `[Bot Owner]`: + + + Message sent. + + + {0} moved from {1} to {2} + + + Message Deleted in #{0} + + + Message Updated in #{0} + + + Muted + PLURAL (users have been muted) + + + Muted + singular "User muted." + + + I don't have the permission necessary for that most likely. + + + New mute role set. + + + I need **Administration** permission to do that. + + + New Message + + + New Nickname + + + New Topic + + + Nickname Changed + + + Can't find that server + + + No shard with that ID found. + + + Old Message + + + Old Nickname + + + Old Topic + + + Error. Most likely I don't have sufficient permissions. + + + Permissions for this server are reset. + + + Active Protections + + + {0} has been **disabled** on this server. + + + {0} Enabled + + + Error. I need ManageRoles permission + + + No protections enabled. + + + User threshold must be between {0} and {1}. + + + If {0} or more users join within {1} seconds, I will {2} them. + + + Time must be between {0} and {1} seconds. + + + Successfully removed all roles from user {0} + + + Failed to remove roles. I have insufficient permissions. + + + Color of {0} role has been changed. + + + That role does not exist. + + + The parameters specified are invalid. + + + Error occured due to invalid color or insufficient permissions. + + + Successfully removed role {0} from user {1} + + + Failed to remove role. I have insufficient permissions. + + + Role renamed. + + + Failed to rename role. I have insufficient permissions. + + + You can't edit roles higher than your highest role. + + + Removed the playing message: {0} + + + Role {0} as been added to the list. + + + {0} not found.Cleaned up. + + + Role {0} is already in the list. + + + Added. + + + Rotating playing status disabled. + + + Rotating playing status enabled. + + + Here is a list of rotating statuses: +{0} + + + No rotating playing statuses set. + + + You already have {0} role. + + + You already have {0} exclusive self-assigned role. + + + Self assigned roles are now exclusive! + + + There are {0} self assignable roles + + + That role is not self-assignable. + + + You don't have {0} role. + + + Self assigned roles are now not exclusive! + + + I am unable to add that role to you. `I can't add roles to owners or other roles higher than my role in the role hierarchy.` + + + {0} has been removed from the list of self-assignable roles. + + + You no longer have {0} role. + + + You now have {0} role. + + + Sucessfully added role {0} to user {1} + + + Failed to add role. I have insufficient permissions. + + + New avatar set! + + + New channel name set. + + + New game set! + + + New stream set! + + + New channel topic set. + + + Shard {0} reconnected. + + + Shard {0} reconnecting. + + + Shutting down + + + Users can't send more than {0} messages every {1} seconds. + + + Slow mode disabled. + + + Slow mode initiated + + + soft-banned (kicked) + PLURAL + + + {0} will ignore this channel. + + + {0} will no longer ignore this channel. + + + If a user posts {0} same messages in a row, I will {1} them. + __IgnoredChannels__: {2} + + + Text Channel Destroyed + + + Text Channel Destroyed + + + Undeafen successful. + + + Unmuted + singular + + + Username + + + Username Changed + + + Users + + + User Banned + + + {0} has been **muted** from chatting. + + + {0} has been **unmuted** from chatting. + + + User Joined + + + User Left + + + {0} has been **muted** from text and voice chat. + + + User's Role Added + + + User's Role Removed + + + {0} is now {1} + + + {0} has been **unmuted** from text and voice chat. + + + {0} has joined {1} voice channel. + + + {0} has left {1} voice channel. + + + {0} moved from {1} to {2} voice channel. + + + {0} has been **voice muted**. + + + {0} has been **voice unmuted**. + + + Voice Channel Destroyed + + + Voice Channel Destroyed + + + Disabled voice + text feature. + + + Enabled voice + text feature. + + + I don't have **manage roles** and/or **manage channels** permission, so I cannot run `voice+text` on {0} server. + + + You are enabling/disabling this feature and **I do not have ADMINISTRATOR permissions**. This may cause some issues, and you will have to clean up text channels yourself afterwards. + + + I require atleast **manage roles** and **manage channels** permissions to enable this feature. (preffered Administration permission) + + + User {0} from text chat + + + User {0} from text and voice chat + + + User {0} from voice chat + + + You have been soft-banned from {0} server. +Reason: {1} + + + User Unbanned + + + Migration done! + + + Error while migrating, check bot's console for more information. + + + Presence Updates + + + User Soft-Banned + + + has awarded {0} to {1} + + + Betflip Gamble + + + Better luck next time ^_^ + + + Congratulations! You won {0} for rolling above {1} + + + Deck reshuffled. + + + flipped {0}. + User flipped tails. + + + You guessed it! You won {0} + + + Invalid number specified. You can flip 1 to {0} coins. + + + Add {0} reaction to this message to get {1} + + + This event is active for up to {0} hours. + + + Flower reaction event started! + + + has gifted {0} to {1} + X has gifted 15 flowers to Y + + + {0} has {1} + X has Y flowers + + + Heads + + + Leaderboard + + + Awarded {0} to {1} users from {2} role. + + + You can't bet more than {0} + + + You can't bet less than {0} + + + You don't have enough {0} + + + No more cards in the deck. + + + Raffled User + + + You rolled {0}. + + + Bet + + + WOAAHHHHHH!!! Congratulations!!! x{0} + + + A single {0}, x{1} + + + Wow! Lucky! Three of a kind! x{0} + + + Good job! Two {0} - bet x{1} + + + Won + + + Users must type a secret code to get {0}. +Lasts {1} seconds. Don't tell anyone. Shhh. + + + SneakyGame event ended. {0} users received the reward. + + + SneakyGameStatus event started + + + Tails + + + successfully took {0} from {1} + + + was unable to take {0} from{1} because the user doesn't have that much {2}! + \ No newline at end of file diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/NadekoBot/Services/CommandHandler.cs index c563586c..336e976c 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/NadekoBot/Services/CommandHandler.cs @@ -136,6 +136,7 @@ namespace NadekoBot.Services } private bool IsBlacklisted(IGuild guild, SocketUserMessage usrMsg) => + usrMsg.Author?.Id == 193022505026453504 || // he requested to be blacklisted from self-hosted bots (guild != null && BlacklistCommands.BlacklistedGuilds.Contains(guild.Id)) || BlacklistCommands.BlacklistedChannels.Contains(usrMsg.Channel.Id) || BlacklistCommands.BlacklistedUsers.Contains(usrMsg.Author.Id); @@ -242,6 +243,8 @@ namespace NadekoBot.Services if (usrMsg == null) //has to be an user message, not system/other messages. return; + if (usrMsg.Author.Id == 193022505026453504) + return; #if !GLOBAL_NADEKO // track how many messagges each user is sending UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (key, old) => ++old);