public async Task AddArena(Lobby data) { var existingLobby = await LobbyController.GetLobby(_context, data.GuildId, data.ChannelId, data.OwnerId); if (existingLobby != null) { existingLobby.RoomId = data.RoomId; existingLobby.Password = data.Password; existingLobby.Comment = data.Comment; existingLobby.PublishTime = data.PublishTime; await LobbyController.UpdateLobby(_context, existingLobby); } else { var key = new { gId = data.GuildId, cId = data.ChannelId, uId = data.OwnerId }; await LobbyController.CreateLobby(_context, data); var timerData = new TimerData { timeSpan = _arenaTimeSpan }; timerData.callback += async() => await Pop(data.GuildId, data.ChannelId, data.OwnerId); _deleteTimerService.SaveData(key, timerData); } }
public async Task ChangeComment(DiscordGuild guild, DiscordChannel channel, DiscordUser user, string comment) { var lobby = await LobbyController.GetLobby(_context, guild, channel, user); lobby.Comment = comment; await LobbyController.UpdateLobby(_context, lobby); }
public async Task MakeArenaGlobal(DiscordGuild guild, DiscordChannel channel, DiscordUser user) { var lobby = await LobbyController.GetLobby(_context, guild, channel, user); if (lobby.Global) { return; } lobby.Global = true; await LobbyController.UpdateLobby(_context, lobby); }
/// <summary> /// Resets the timer for the provided Lobby. /// </summary> /// <param name="resetTime">The new time that will be used for reference.</param> /// <returns>If any lobby was found that could be reseted.</returns> public async Task <bool> ResetTimer(DiscordGuild guild, DiscordChannel channel, DiscordUser user, DateTimeOffset resetTime) { var lobby = await LobbyController.GetLobby(_context, guild, channel, user); if (lobby == null) { return(false); } lobby.RemovalReferenceTime = resetTime; return(true); }