public async Task SetBanDurationAsync(long banID, TimeSpan newDuration) { var getBan = await _bans.GetBanAsync(this.Context.Guild, banID); if (!getBan.IsSuccess) { await _feedback.SendErrorAsync(this.Context, getBan.ErrorReason); return; } var ban = getBan.Entity; var newExpiration = ban.CreatedAt.Add(newDuration); var setExpiration = await _bans.SetBanExpiryDateAsync(ban, newExpiration); if (!setExpiration.IsSuccess) { await _feedback.SendErrorAsync(this.Context, setExpiration.ErrorReason); return; } await _feedback.SendConfirmationAsync(this.Context, "Ban duration updated."); }
public async Task <Result <FeedbackMessage> > SetBanDurationAsync(long banID, TimeSpan newDuration) { var getBan = await _bans.GetBanAsync(_context.GuildID.Value, banID); if (!getBan.IsSuccess) { return(Result <FeedbackMessage> .FromError(getBan)); } var ban = getBan.Entity; var newExpiration = ban.CreatedAt.Add(newDuration); var setExpiration = await _bans.SetBanExpiryDateAsync(ban, newExpiration); return(setExpiration.IsSuccess ? new FeedbackMessage("Ban duration updated.", _feedback.Theme.Secondary) : Result <FeedbackMessage> .FromError(setExpiration)); }
public async Task <RuntimeResult> SetBanDurationAsync(long banID, TimeSpan newDuration) { var getBan = await _bans.GetBanAsync(this.Context.Guild, banID); if (!getBan.IsSuccess) { return(getBan.ToRuntimeResult()); } var ban = getBan.Entity; var newExpiration = ban.CreatedAt.Add(newDuration); var setExpiration = await _bans.SetBanExpiryDateAsync(ban, newExpiration); if (!setExpiration.IsSuccess) { return(setExpiration.ToRuntimeResult()); } return(RuntimeCommandResult.FromSuccess("Ban duration updated.")); }