you can now divorce people using their id

This commit is contained in:
Master Kwoth 2017-05-16 18:53:10 +02:00
parent cf9d58a7eb
commit 749c63aec3

View File

@ -188,9 +188,15 @@ namespace NadekoBot.Modules.Gambling
private static readonly TimeSpan _divorceLimit = TimeSpan.FromHours(6); private static readonly TimeSpan _divorceLimit = TimeSpan.FromHours(6);
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Divorce([Remainder]IUser target) [Priority(1)]
public Task Divorce([Remainder]IUser target) => Divorce(target.Id);
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[Priority(0)]
public async Task Divorce([Remainder]ulong targetId)
{ {
if (target.Id == Context.User.Id) if (targetId == Context.User.Id)
return; return;
DivorceResult result; DivorceResult result;
@ -199,7 +205,7 @@ namespace NadekoBot.Modules.Gambling
WaifuInfo w = null; WaifuInfo w = null;
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())
{ {
w = uow.Waifus.ByWaifuUserId(target.Id); w = uow.Waifus.ByWaifuUserId(targetId);
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
if (w?.Claimer == null || w.Claimer.UserId != Context.User.Id) if (w?.Claimer == null || w.Claimer.UserId != Context.User.Id)
result = DivorceResult.NotYourWife; result = DivorceResult.NotYourWife;