public async Task ClearChat(string channelName) { var joinedChannel = _twitchClient.GetJoinedChannel(channelName); _twitchClient.ClearChat(joinedChannel); await Task.CompletedTask; }
private void ClearChat(OnMessageReceivedArgs e) { if (e.ChatMessage.IsModerator || e.ChatMessage.IsBroadcaster) { Console.WriteLine("Clearing Chat..."); client.ClearChat(e.ChatMessage.Channel); } }
public void HandleTwitchCommand(string spokenText) { if (spokenText.IncludesTheWords("start", "follower", "only") || spokenText.IncludesTheWords("start", "followers", "only")) { _client.FollowersOnlyOn(_twitchBotSettings.ChannelName, TEN_MINUTES); } else if (spokenText.IncludesTheWords("stop", "follower", "only") || spokenText.IncludesTheWords("stop", "followers", "only")) { _client.FollowersOnlyOff(_twitchBotSettings.ChannelName); } else if (spokenText.IncludesTheWords("start", "sub", "only") || spokenText.IncludesTheWords("start", "subs", "only") || spokenText.IncludesTheWords("start", "subscriber", "only") || spokenText.IncludesTheWords("start", "subscribers", "only")) { _client.SubscribersOnlyOn(_twitchBotSettings.ChannelName); } else if (spokenText.IncludesTheWords("stop", "sub", "only") || spokenText.IncludesTheWords("stop", "subs", "only") || spokenText.IncludesTheWords("stop", "subscriber", "only") || spokenText.IncludesTheWords("stop", "subscribers", "only")) { _client.SubscribersOnlyOff(_twitchBotSettings.ChannelName); } else if (spokenText.IncludesTheWords("start", "slow", "mode")) { _client.SlowModeOn(_twitchBotSettings.ChannelName, TEN_MINUTES); } else if (spokenText.IncludesTheWords("stop", "slow", "mode")) { _client.SlowModeOff(_twitchBotSettings.ChannelName); } else if (spokenText.IncludesTheWords("clear", "chat")) { _client.ClearChat(_twitchBotSettings.ChannelName); } else { HandleCustomCommands(spokenText); } }
private void Client_OnMessageReceived(object sender, OnMessageReceivedArgs e) { switch (e.ChatMessage.Message) { case "!hello": { client.SendMessage(TwitchInfo.ChannelName, $"Hey there {e.ChatMessage.DisplayName}"); } break; case "!schedule": { client.SendMessage(TwitchInfo.ChannelName, $"@{e.ChatMessage.DisplayName} XxHavocBlastxX has no schedule at all sadly, he streams mostly in the evenings and on weekends"); } break; case "!uptime": { // TODO } break; case "!havocBot": { client.SendMessage(TwitchInfo.ChannelName, $"Hello, I am HavocBot, I am HavocBlast's custom made bot, I am pretty dumb at the moment :)"); } break; case "!twitter": { client.SendMessage(TwitchInfo.ChannelName, $"You can follow HavocBlast on Twitter at {TwitchInfo.TwitterUrl}"); } break; case "!currentProject": { client.SendMessage(TwitchInfo.ChannelName, $"@{e.ChatMessage.DisplayName} Civies™ is a Civilian Roleplaying game where you have just moved into a new town and have to rebuild your life from scratch. Find a job or other way to make money and make your life."); } break; case "!clear": { if (e.ChatMessage.IsBroadcaster || e.ChatMessage.IsModerator) { client.ClearChat(TwitchInfo.ChannelName); } } break; case "!devTools": { client.SendMessage(TwitchInfo.ChannelName, $"@{e.ChatMessage.DisplayName} xXHavocBlastxX uses Unreal Engine 4 as his primary engine, Autodesk Maya as his primary 3D Modelling Software and Substance Painter and Designer for Textures and such"); } break; case "!break": { client.SendMessage(TwitchInfo.ChannelName, $"XxHavocBlastxX has gone for a break, the stream will resume shortly"); } break; case "!help": { client.SendMessage(TwitchInfo.ChannelName, "The current implemented commands are: \n 1) !Hello (Allows HavocBot to say Hi!) \n2) !schedule (Gives information about XxHavocBlastXx's schedule for streaming \n3) !twitter (Prints out a link to XxHavocBlastXx's Twitter) " + "\n4) !currentProject (Gives everyone current information based on XxHavocBlastXx's current project he is working on \n5) !devTools (Displays what current tools XxHavocBlastXx is currently using for work)"); } break; case "!donate": { client.SendMessage(TwitchInfo.ChannelName, "You can donate via patreon: https://www.patreon.com/ or my tip page: https://streamlabs.com/xxhavocblastxx"); } break; case "!discord": { client.SendMessage(TwitchInfo.ChannelName, "You can join our Discord here: https://discord.gg/C2BU3eH"); } break; case "!ban": { client.BanUser(TwitchInfo.ChannelName, e.ChatMessage.Username, "You have been banned"); } break; case "!leave": { if (e.ChatMessage.IsBroadcaster || e.ChatMessage.IsModerator) { client.SendMessage(TwitchInfo.ChannelName, $"HavocBot out! Peace!"); disconnect(); } } break; } }
internal static void ClearChat(TwitchClient client) { client.ClearChat(client.GetJoinedChannel(client.JoinedChannels[0].Channel).Channel); }