Example #1
0
        private void ClientOnUserTimedout(object sender, OnUserTimedoutArgs e)
        {
            var user = _db.GetOrCreate(e.UserTimeout.Username);

            user.IsActive = false;
            Debug.Log($"[Client] {e.UserTimeout.Username} timed out");
        }
 public static void KiraOnUserTimedout(object s, OnUserTimedoutArgs e, CallbackArgs args)
 {
     var twoUsers = new List <Tuple <string, string> >
     {
         new("th3globalist", "74415861"),
         new("rinael_lapki", "116926816")
     };
Example #3
0
        //private void GetAuthToken()
        //{
        //    try
        //    {
        //        try
        //        {
        //            p = System.Diagnostics.Process.Start("Chrome.exe", $"--app=https://id.twitch.tv/oauth2/authorize?client_id={Settings.ClientId}&redirect_uri=http://localhost:7425&response_type=code&scope=channel_check_subscription --window-size=600,800");
        //        }
        //        catch
        //        {

        //            p = System.Diagnostics.Process.Start("firefox.exe", $"https://id.twitch.tv/oauth2/authorize?client_id={Settings.ClientId}&redirect_uri=http://localhost:7425&response_type=code&scope=channel_check_subscription");
        //        }
        //    }
        //    catch
        //    {
        //        p = System.Diagnostics.Process.Start("MicrosoftEdge.exe", $"https://id.twitch.tv/oauth2/authorize?client_id={Settings.ClientId}&redirect_uri=http://localhost:7425&response_type=code&scope=channel_check_subscription");
        //    }
        //    p.Exited += (object sender, EventArgs e) =>
        //    {
        //        Thread.CurrentThread.Abort();
        //    };
        //    Task t = new Task(async () =>
        //    {
        //        var prefix = "http://localhost:7425/";
        //        HttpListener listener = new HttpListener();
        //        listener.Prefixes.Add(prefix);
        //        try
        //        {
        //            listener.Start();
        //        }
        //        catch (HttpListenerException hlex)
        //        {
        //        }

        //        while (listener.IsListening && !p.HasExited)
        //        {
        //            try
        //            {

        //                var context = await listener.GetContextAsync();

        //                if (!string.IsNullOrEmpty(context.Request.QueryString["code"]))
        //                {
        //                    Settings.AuthToken = "a38dd5of0jsy47mjve7f1hwinegpy7";
        //                    listener.Close();
        //                    p.Kill();
        //                }
        //                else
        //                {
        //                    listener.Close();
        //                    p.Kill();
        //                }
        //            }
        //            catch
        //            {
        //            }
        //        }
        //    }
        //    );
        //    t.Start();
        //    while(!t.IsCompleted && !p.HasExited)
        //    {

        //    }
        //}

        //public async void RunHttp(Process p)
        //{
        //    var prefix = "http://localhost:7425/";
        //    HttpListener listener = new HttpListener();
        //    listener.Prefixes.Add(prefix);
        //    try
        //    {
        //        listener.Start();
        //    }
        //    catch (HttpListenerException hlex)
        //    {
        //    }

        //    while (listener.IsListening && !p.HasExited)
        //    {
        //        try
        //        {

        //            var context = await listener.GetContextAsync();

        //            if (!string.IsNullOrEmpty(context.Request.QueryString["code"]))
        //            {
        //                Settings.AuthToken = "a38dd5of0jsy47mjve7f1hwinegpy7";
        //                listener.Close();
        //                p.Kill();
        //            }
        //            else
        //            {
        //                listener.Close();
        //                p.Kill();
        //            }
        //        }
        //        catch
        //        {
        //        }
        //    }
        //}

        private void Client_TimedOut(object sender, OnUserTimedoutArgs e)
        {
            window.Dispatcher.Invoke((Action)(() =>
            {
                window.BotStopped();
            }));
        }
Example #4
0
 public void Client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
 {
     if (BotEnvironment.Settings["bot.gun.enabled"] == "true")
     {
         BotEnvironment.PlayAudio(WeaponsAudios);
     }
 }
Example #5
0
 private void OnUserTimedout(object sender, OnUserTimedoutArgs e)
 {
     Invoke((MethodInvoker) delegate
     {
         lblVerbunden.ForeColor = Color.FromArgb(6, 244, 0); //GrĂ¼n
         lblDebug.Text          = e.UserTimeout.Channel;
     });
 }
Example #6
0
        /// <summary>
        /// Invokes the user timedout.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="channel">The channel.</param>
        /// <param name="username">The username.</param>
        /// <param name="timeoutDuration">Duration of the timeout.</param>
        /// <param name="timeoutReason">The timeout reason.</param>
        public static void InvokeUserTimedout(this TwitchClient client, string channel, string username, int timeoutDuration, string timeoutReason)
        {
            OnUserTimedoutArgs model = new OnUserTimedoutArgs()
            {
                UserTimeout = new UserTimeout(channel, username, timeoutDuration, timeoutReason)
            };

            client.RaiseEvent("OnUserTimedout", model);
        }
        public static async void OnUserTimedOut(object sender, OnUserTimedoutArgs e)
        {
            var client  = new RestClient(WebSocketSettings.LocalBotCommandRelayUrl);
            var request = new RestRequest(Method.GET);

            request.AddQueryParameter("command", "timeout");
            request.AddQueryParameter("message", $"{e.UserTimeout.Username} timed out for {e.UserTimeout.TimeoutDuration} seconds. Reason: {e.UserTimeout.TimeoutReason} Kappa");

            await client.ExecuteGetTaskAsync(request);
        }
Example #8
0
 internal static UserTimedoutEvent Map(this OnUserTimedoutArgs from)
 {
     return(new UserTimedoutEvent
     {
         Channel = from.UserTimeout.Channel,
         TimeoutDuration = from.UserTimeout.TimeoutDuration,
         TimeoutReason = from.UserTimeout.TimeoutReason,
         Username = from.UserTimeout.Username
     });
 }
Example #9
0
        private void Client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
        {
            consoleMessage[1] = "#";
            consoleMessage[3] = e.Username;
            consoleMessage[4] = e.Channel;
            consoleMessage[5] = "Timed Out";
            //string message = $"[{DateTime.Now.ToString("MM/dd - HH:mm")} | Twitch] {e.Username} has been timed out.";
            Program.SendToConsole(consoleMessage);

            client.SendMessage($"Get rekt {e.Username}");
        }
Example #10
0
        private void OnUserTimedout(object sender, OnUserTimedoutArgs e)
        {
            string content = "";

            content = "<div><span style=\"color:#A4A0A0; font-family:Arial,Helvetica,sans-serif; font-size:10pt;\">" + e.Username + " has been timed out from " + e.Channel + "for " + e.TimeoutDuration + " seconds. Reason: " + e.TimeoutReason + "</span></div>";
            if (webChat.InvokeRequired)
            {
                Action act = () => this.webChat.Document.Body.InnerHtml += content;
                webChat.Invoke(act);
                act = () => ScrollToBottom();
                webChat.Invoke(act);
            }
        }
Example #11
0
            private void Client_OnUserTimedOut(object sender, OnUserTimedoutArgs e)
            {
                var resp = this.parent.monitor.API.V5.Users.GetUserByNameAsync(e.UserTimeout.Username).Result;

                if (resp.Total <= 0)
                {
                    Console.WriteLine($"OnUserTimedOut failed to find {e.UserTimeout.Username}");
                    return;
                }

                if (Program.spk.currentMessage != null && Program.spk.currentMessage.User == resp.Matches[0].Id)
                {
                    Program.spk.SkipSpeak();
                }
            }
Example #12
0
        public void ShouldSpoolCorrectMessage()
        {
            var args = new OnUserTimedoutArgs()
            {
                UserTimeout = new UserTimeout(
                    channel: Guid.NewGuid().ToString(),
                    username: Guid.NewGuid().ToString(),
                    timeoutDuration: new Random().Next(),
                    timeoutReason: Guid.NewGuid().ToString())
            };

            Sut.TwitchClient_OnUserTimedout(null, args);

            MockedTwitchClientManager
            .Verify(x => x.SpoolMessage(PrimaryChannelName, $"WideHardo FREE MY MAN {args.UserTimeout.Username.ToUpper()}", Priority.Medium),
                    Times.Once());
        }
Example #13
0
            private void Client_OnUserTimedOut(object sender, OnUserTimedoutArgs e)
            {
                timedout.Add(e.UserTimeout.Username, Program.currentTime() + (long)e.UserTimeout.TimeoutDuration);

                if (e.UserTimeout.Username == SpeakingUser)
                {
                    if (Monitor.TryEnter(SpeakingLock))                       //We are not speaking
                    {
                        Monitor.Exit(SpeakingLock);
                    }
                    else                         //We are speaking
                    {
                        Console.WriteLine("Interrupting TTS...");
                        Thread.CurrentThread.Interrupt();
                    }
                }
            }
Example #14
0
        private void Client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
        {
            string sentence = "";

            Random rnd = new Random();
            int    val = rnd.Next(0, 3);

            switch (val)
            {
            case 0:
                sentence = "got ZIPPED lol!";
                break;

            case 1:
                sentence = "get rekt scrub!";
                break;

            case 2:
                sentence = "git gud!";
                break;
            }

            client.SendMessage(TwitchInfo.ChannelName, $"{e.UserTimeout.Username} " + sentence.ToString());
        }
Example #15
0
 public void onUserTimedout(object sender, OnUserTimedoutArgs e)
 {
     MessageBox.Show($"Viewer {e.Username} in channel {e.Channel} was timedout for {e.TimeoutDuration} seconds with reasoning: {e.TimeoutReason}");
 }
 private void Client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
 => OnUserTimedout?.Invoke(this, e.Map());
Example #17
0
 /// <summary>
 /// Called when a viewer has been timed out from chat.
 /// </summary>
 private void Client_OnUserTimeout(object sender, OnUserTimedoutArgs e)
 {
     Console.WriteLine($"[{e.UserTimeout.Channel}] Timed out the user {e.UserTimeout.Username} for {e.UserTimeout.TimeoutDuration} seconds. Reason: {e.UserTimeout.TimeoutReason}.");
     client.SendMessage(e.UserTimeout.Channel, $"Timed out the user {e.UserTimeout.Username} for {e.UserTimeout.TimeoutReason} seconds. Reason: {e.UserTimeout.TimeoutReason}.");
 }
 private void Client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
 {
     client.SendMessage(TwitchInfo.ChannelName, $"Get rekt bro");
 }
Example #19
0
 private void _client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
 {
 }
Example #20
0
 /// <summary>
 /// Passes <see cref="OnUserTimedout"/> events down to subscribed plugins.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="OnUserTimedoutArgs"/> object.</param>
 private void TwitchClient_OnUserTimedout(object sender, OnUserTimedoutArgs e) => this.OnUserTimedout?.Invoke(this, e);
Example #21
0
 public void TwitchClient_OnUserTimedout(Object sender, OnUserTimedoutArgs e)
 {
     TwitchClientManager.SpoolMessage($"WideHardo FREE MY MAN {e.UserTimeout.Username.ToUpper()}");
 }
Example #22
0
 private void Client_OnUserTimedout(object sender, OnUserTimedoutArgs e)
 {
     Console.ForegroundColor = ConsoleColor.Cyan;
     Console.WriteLine("Mod Action: {0} was timed out for {1} because [{2}]", e.UserTimeout.Username, e.UserTimeout.TimeoutDuration, e.UserTimeout.TimeoutReason);
     Console.ResetColor();
 }