public async Task CmdRefreshBossFight() { try { // Check if any fighters are queued or fighting if (_bossFightSettingsInstance.Fighters.Count > 0) { _irc.SendPublicChatMessage($"A boss fight is either queued or in progress @{_botConfig.Broadcaster}"); return; } // Get current game name ChannelJSON json = await _twitchInfo.GetBroadcasterChannelById(); string gameTitle = json.Game; // Grab game id in order to find party member TwitchGameCategory game = await _gameDirectory.GetGameId(gameTitle); // During refresh, make sure no fighters can join _bossFightSettingsInstance.RefreshBossFight = true; await _bossFightSettingsInstance.LoadSettings(_broadcasterInstance.DatabaseId, game?.Id, _botConfig.TwitchBotApiLink); _bossFightSettingsInstance.RefreshBossFight = false; _irc.SendPublicChatMessage($"Boss fight settings refreshed @{_botConfig.Broadcaster}"); } catch (Exception ex) { await _errHndlrInstance.LogError(ex, "CmdBrdCstr", "CmdRefreshBossFight()", false, "!refreshbossfight"); } }
/// <summary> /// Removes first party memeber in queue of party up requests /// </summary> public async Task CmdPopPartyUpRequest() { try { // get current game info ChannelJSON json = await _twitchInfo.GetBroadcasterChannelById(); string gameTitle = json.Game; TwitchGameCategory game = await _gameDirectory.GetGameId(gameTitle); if (string.IsNullOrEmpty(gameTitle)) { _irc.SendPublicChatMessage("I cannot see the name of the game. It's currently set to either NULL or EMPTY. " + "Please have the chat verify that the game has been set for this stream. " + $"If the error persists, please have @{_botConfig.Broadcaster.ToLower()} retype the game in their Twitch Live Dashboard. " + "If this error shows up again and your chat can see the game set for the stream, please contact my master with !support in this chat"); } else if (game?.Id > 0) { _irc.SendPublicChatMessage(await _partyUp.PopRequestedPartyMember(game.Id, _broadcasterId)); } else { _irc.SendPublicChatMessage("This game is not part of the \"Party Up\" system"); } } catch (Exception ex) { await _errHndlrInstance.LogError(ex, "CmdMod", "CmdPopPartyUpRequest()", false, "!poppartyuprequest"); } }
private async void Run() { await LoadReminderContext(); // initial load DateTime midnightNextDay = DateTime.Today.AddDays(1); while (true) { ChannelJSON channelJSON = await TwitchApi.GetBroadcasterChannelById(_twitchClientId); string gameTitle = channelJSON.Game; TwitchGameCategory game = await _gameDirectory.GetGameId(gameTitle); if (game == null || game.Id == 0) { _gameId = null; } else { _gameId = game.Id; } // remove pending reminders Program.DelayedMessages.RemoveAll(r => r.ReminderId > 0); foreach (RemindUser reminder in _reminders.OrderBy(m => m.RemindEveryMin)) { if (IsEveryMinReminder(reminder)) { continue; } else if (IsCountdownEvent(reminder)) { continue; } else { AddDayOfReminder(reminder); } } if (_refreshReminders) { _irc.SendPublicChatMessage("Reminders refreshed!"); } // reset refresh midnightNextDay = DateTime.Today.AddDays(1); _refreshReminders = false; // wait until midnight to check reminders // unless a manual refresh was called while (DateTime.Now < midnightNextDay && !_refreshReminders) { Thread.Sleep(1000); // 1 second } } }
/// <summary> /// Removes first party memeber in queue of party up requests /// </summary> public async Task CmdPopPartyUpRequest() { try { // get current game info ChannelJSON json = await _twitchInfo.GetBroadcasterChannelById(); string gameTitle = json.Game; GameList game = await _gameDirectory.GetGameId(gameTitle); _irc.SendPublicChatMessage(await _partyUp.PopRequestedPartyMember(game.Id, _broadcasterId)); } catch (Exception ex) { await _errHndlrInstance.LogError(ex, "CmdMod", "CmdPopPartyUpRequest()", false, "!poppartyuprequest"); } }
/// <summary> /// Removes first party memeber in queue of party up requests /// </summary> public async Task CmdPopPartyUpRequest() { try { // get current game info ChannelJSON json = await _twitchInfo.GetBroadcasterChannelById(); string gameTitle = json.Game; TwitchGameCategory game = await _gameDirectory.GetGameId(gameTitle); if (game?.Id > 0) { _irc.SendPublicChatMessage(await _partyUp.PopRequestedPartyMember(game.Id, _broadcasterId)); } else { _irc.SendPublicChatMessage("This game is not part of the \"Party Up\" system"); } } catch (Exception ex) { await _errHndlrInstance.LogError(ex, "CmdMod", "CmdPopPartyUpRequest()", false, "!poppartyuprequest"); } }