public async Task LeaveAsync(IGuildUser?guildUser) { if (guildUser == null) { return; } var userInGuild = guildData.GetUser(guildUser.Id); if (userInGuild == null) { await Context.Message.ReplyAsync($"User is not on the waiting list!"); } else { userInGuild.IsInWaitingList = false; userInGuild.JoinTime = default; dataContext.Update(userInGuild); dataContext.SaveChanges(); await Context.Message.ReplyAsync($"User left the waiting list!"); await ButtonWaitingListModule.UpdatePublicMessageAsync(waitingList, Context.Guild, guildData); } }
public Task <CommandResult> RemoveUserAsync(ulong guildUserId) { var user = guildData.GetUser(guildUserId); if (user == null) { return(Task.FromResult(CommandResult.FromError("You are not on the waiting list!"))); } else { user.IsInWaitingList = false; user.JoinTime = default; dataContext.Update(user); return(Task.FromResult(CommandResult.FromSuccess("You left the waiting list!"))); } }