public async Task DisplayPointsSelf() { var user = Context.User; int karma = _karmaTable.GetKarma(user); await ReplyAsync($"{ user.Mention }, you have { karma } points."); }
public async Task ThankUserCommand([Remainder] IGuildUser user) { IUser source = Context.User, target = user; if (source == target) { await ReplyAsync("You can't thank yourself!"); return; } if (_karmaTable.CheckThanksCooldownExpired(source, target, out int remainingMinutes)) { int.TryParse(_settings["thanks"], out int cooldown); _karmaTable.ThankUser(source, target, cooldown); int total = _karmaTable.GetKarma(target); string pointsDisplay = $"{ total } point{ (total != 1 ? "s" : "") }"; await ReplyAsync($"{ user.Mention } has { pointsDisplay }."); } else { int hours = remainingMinutes / 60; int minutes = remainingMinutes % 60; string displayhours = $"{ hours } hour{ (minutes != 1 ? "s" : "") }"; string displayminutes = $"{ minutes } minute{ (minutes != 1 ? "s" : "") }"; await ReplyAsync($"{ source.Mention }, you can't thank that user yet, please wait { displayhours }{ (minutes > 0 ? $" and { displayminutes }" : "") }."); } }
public async Task DisplayPointsSelf() { var user = Context.User; int karma = _karmaTable.GetKarma(user); string pointsDisplay = $"{ karma } point{ (karma != 1 ? "s" : "") }"; await ReplyAsync($"{ user.Mention }, you have { pointsDisplay }."); }
public async Task ThankUserCommand([Remainder] IGuildUser user) { IUser source = Context.User, target = user; if (source == target) { throw new System.Exception("You cannot thank yourself."); } _karmaTable.AddKarma(target); int total = _karmaTable.GetKarma(target); string pointsDisplay = $"{ total } point{ (total != 1 ? "s" : "") }"; var message = await ReplyAsync($"{ user.GetDisplayName() } has { pointsDisplay }."); _ = message.TimedDeletion(5000); }