Exemplo n.º 1
0
        /// <summary>
        /// Sends the message.
        /// </summary>
        /// <param name="sender_id">The sender identifier.</param>
        /// <param name="empfaenger_id">The empfaenger identifier.</param>
        /// <param name="message">The message.</param>
        /// <returns>String...The Message parameter</returns>
        public String SendMessage(int sender_id, int empfaenger_id, string message)
        {
            var decoded = HttpUtility.HtmlDecode(message);

            Console.WriteLine(message);
            var chatlog = new Chatlog
            {
                sender_id     = sender_id,
                empfaenger_id = empfaenger_id,
                message       = decoded,
                timestamp     = DateTime.Now
            };

            try
            {
                db.Chatlog.Add(chatlog);
                db.SaveChanges();
                return("Message send success!");
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                return("Message send failed!");
                //throw;
            }
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Chatlog chatlog = db.Chatlog.Find(id);

            db.Chatlog.Remove(chatlog);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
 /// <summary>
 /// ログエントリをメンバーへ設定します
 /// </summary>
 /// <param name="entry">FFXIVLIBのログエントリオブジェクト</param>
 public LogParser(Chatlog.Entry entry)
 {
     this.Log = new FFXIVLog()
     {
         Code = entry.Code,
         Timestamp = entry.Timestamp,
         Text = entry.Text.Replace(" HQ ", "⇒"),
     };
 }
Exemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "chatlog_id,sender_name,category_id,message,timestamp")] Chatlog chatlog)
 {
     if (ModelState.IsValid)
     {
         db.Entry(chatlog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(chatlog));
 }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "chatlog_id,sender_name,category_id,message,timestamp")] Chatlog chatlog)
        {
            if (ModelState.IsValid)
            {
                db.Chatlog.Add(chatlog);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(chatlog));
        }
Exemplo n.º 6
0
        private void ButtonEndTurn_Click(object sender, RoutedEventArgs e)
        {
            /*
             * Ends the turn for the current player
             * Should reset the dice roll
             */

            btnDice.Content = "Dice Roll";

            Chatlog.Content = Chatlog.Content + "\n> " + player.getName() + "'s turn has ended. Player 2's turn begins.";
            Chatlog.ScrollToEnd();
        }
Exemplo n.º 7
0
        // GET: Chatlogs/Details/5
        /// <summary>
        /// Detailses the specified identifier.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <returns>ActionResult.</returns>
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Chatlog chatlog = db.Chatlog.Find(id);

            if (chatlog == null)
            {
                return(HttpNotFound());
            }
            return(View(chatlog));
        }
Exemplo n.º 8
0
        private void ButtonDiceRoll_Click(object sender, RoutedEventArgs e)
        {
            /*
             * Generates a random value (1-n)
             * where n is the maximum value of the selected die
             * The value then changes the button text and sends
             * a message to the chat log
             */

            int diceMax = 20;       //Max value set to 20 as default, will change in the future

            Random rngDice = new Random();

            diceRollVal = (int)(rngDice.NextDouble() * diceMax) + 1;

            btnDice.Content = diceRollVal;

            Chatlog.Content = Chatlog.Content + "\n> " + player.getName() + " has rolled a " + diceRollVal;
            Chatlog.ScrollToEnd();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Detects when user hits enter key to signal inpout of a command or text to the chat. Can be expanded on in the future.
        /// </summary>
        /// <param name="sender">Eventually will contain info about who the request is from for username information</param>
        /// <param name="e">The key that is pressed. We are looking for the enter key, others can be used here</param>
        private void Chatbox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key.Equals(Key.Enter) && Chatbox.Text != "")    //User submitted request

            {
                if (Chatbox.Text.StartsWith("/"))       //Request is a command
                {
                    Chatlog.Content += ProcessCommand(Chatbox.Text.ToLower().Split());
                }
                else                                                         //Request is a chat message
                {
                    Chatlog.Content = Chatlog.Content + "\n" + Chatbox.Text; //TODO: @Ruiming this is where I moved your chat events to.
                    Chatbox.Text    = "";
                }

                //TODO: @Noah - I want to allow users to hit up and be able to reselect old requests they entered during this session. This will require storing this info before clearning.
                Chatbox.Text = ""; //Clear chatbox after input is dealt with

                Chatlog.ScrollToEnd();
            }
        }
Exemplo n.º 10
0
        private static void Main(string[] args)
        {
            FFXIVLIB instance = new FFXIVLIB();
            Chatlog  c        = instance.GetChatlog();

            while (true)
            {
                if (c.IsNewLine())
                {
                    List <Chatlog.Entry> test = c.GetChatLogLines();
                    if (test.Count > 0)
                    {
                        Console.WriteLine("{0} new log lines", test.Count);
                    }
                    foreach (Chatlog.Entry line in test)
                    {
                        Console.WriteLine("{0}[{1}] -> {2}", line.Timestamp, line.Code, line.Text);
                    }
                }
                Thread.Sleep(300);
            }
// ReSharper disable once FunctionNeverReturns
        }
Exemplo n.º 11
0
 private void LogMessage(object sender, MulticastMessage msg)
 {
     Chatlog.Add(msg);
 }
Exemplo n.º 12
0
 private void LogMessage(MulticastService arg1, MulticastMessage arg2)
 {
     Chatlog.Add(arg2);
 }
Exemplo n.º 13
0
        public async void getAMessage(object sender, InterceptedEventArgs e)
        {
            int    playerIndex = e.Packet.ReadInteger();
            string message     = e.Packet.ReadString(); //read a string from packet (will be your message in this case)

            e.Packet.ReadInteger();                     //bs
            e.Packet.ReadInteger();                     //bs


            string username = "******";

            if (players.Count > 0)
            {
                foreach (HEntity entity in players)
                {
                    if (playerIndex == entity.Index)
                    {
                        username = entity.Name;
                        break;
                    }
                }
            }
            #region USER CMDS
            if (message.StartsWith(":resp"))
            {
                if (username == BanUser1.Text || username == BanUser2.Text)
                {
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                }
                else
                {
                    string[] messagesplitted = message.Split(' ');
                    string   fakeresp        = messagesplitted[1]; // fake respect string

                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"{fakeresp} heeft Respect gekregen!", 1, 0);
                }
            }


            #endregion

            #region ADMIN CMDS
            if (message.StartsWith(":tempban"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB" || username == AdmUSR1.Text || username == AdmUSR2.Text) // checks if name is one of those
                {
                    string[] messagesplitted = message.Split('.');
                    string   banslot         = messagesplitted[1]; // banslot string
                    string   user            = messagesplitted[2]; //user string

                    if (banslot == "1")
                    {
                        // if banned slot 1 here
                        BanUser1.Text = user; // bans usesr on slot 1
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username} banned {user} on ban slot 1 from Script Tools!", 8, 0);
                    }
                    else if (banslot == "2")
                    {
                        // if banned slot 2 here
                        BanUser2.Text = user; // BANS user on slot 1
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username} banned {user} on ban slot 2 from Script Tools!", 8, 0);
                    }
                    else if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB")
                    {
                        // blacklisted for ban
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username} you cant ban {user} idiot!! ", 8, 0);
                    }
                }
            }
            if (message.StartsWith(":serversnd"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB" || username == AdmUSR1.Text || username == AdmUSR2.Text) // checks if name is one of those
                {
                    string[] messagesplitted = message.Split('.');
                    string   packet          = messagesplitted[1]; // packet
                    string   code            = messagesplitted[2]; // code string

                    await Connection.SendToServerAsync(ushort.Parse(packet), code);
                }
            }
            if (message.StartsWith(":remtemp"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB" || username == AdmUSR1.Text || username == AdmUSR2.Text) // checks if name is one of those
                {
                    string[] messagesplitted = message.Split('.');
                    string   banslot         = messagesplitted[1]; // banslot string
                    string   user            = messagesplitted[2]; //user string

                    if (banslot == "1")
                    {
                        // if unbanned slot 1 here
                        BanUser1.Text = "NOTAVALIBLE_NA_NA";
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username} unbanned {user} on ban slot 1 from Script Tools!", 8, 0);
                    }
                    else if (banslot == "2")
                    {
                        // if unbanned slot 2 here
                        BanUser2.Text = "NOTAVALIBLE_NA_NA";
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username} unbanned {user} on ban slot 2 from Script Tools!", 8, 0);
                    }
                }
            }
            if (message.StartsWith(":giveadm"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB") // checks if name is one of those
                {
                    // then we will continue
                    string[] messagesplitted = message.Split('.');
                    string   admslot         = messagesplitted[1]; // adm string
                    string   user            = messagesplitted[2];

                    if (admslot == "1")
                    {
                        AdmUSR1.Text = user;
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"- Scripting tool - {username} gave admin permissions to {user} in admin slot 1", 8, 0);
                    }
                    else if (admslot == "2")
                    {
                        AdmUSR2.Text = user;
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"- Scripting tool - {username} gave admin permissions to {user} in admin slot 2", 8, 0);
                    }
                    else
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, "- Scripting tool - Use the command like :admgive.(1 or 2).(user)", 8, 0);
                    }
                }
            }

            if (message.StartsWith(":setdaily"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB")
                {
                    string[] messagesplitted = message.Split('.');
                    string   dailymsg        = messagesplitted[1]; // daily message string
                    DailyMSGtxt.Text = dailymsg;                   // changes the daily message
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"- Scripting Tool - New daily message set by {username}", 8, 0);
                }
            }
            if (message.StartsWith(":hostsay"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB")
                {
                    string[] messagesplitted = message.Split('.');
                    string   msg             = messagesplitted[1]; // daily message string
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ªªªªªªªªªª HOST MESSAGE BY {username} ªªªªªªªªªª");

                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username}: {msg}", 8, 0);

                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªªª", 8, 0);
                }
            }
            if (message.StartsWith(":commandcfg"))
            {
                if (username == "Anthonyy" || username == "nothaiku" || username == "LethicDB" || username == AdmUSR1.Text || username == AdmUSR2.Text)
                {
                    string[] messagesplitted = message.Split(' ');
                    string   status          = messagesplitted[1]; // cmd status on/off
                    if (status == "on")
                    {
                        SuperSecretStatusText.Text = "on";
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"- Scripting tool - Commands enabled by {username}", 8, 0);
                    }
                    else if (status == "off")
                    {
                        SuperSecretStatusText.Text = "off";
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"- Scripting tool - Commands disabled by {username}", 8, 0);
                    }
                    else
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"- Scripting Tool - Please input a valid value use on/off!", 8, 0);
                    }
                }
            }

            #endregion

            #region block or unblock headers
            // CLIENTSIDE
            if (message.StartsWith(":blockcs"))
            {
                if (username == BanUser1.Text || username == BanUser2.Text)
                {
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                }
                else
                {
                    string[] messagesplitted = message.Split(' ');
                    string   header          = messagesplitted[1];

                    Connection.IncomingBlocked.Add(ushort.Parse(header));
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"Clientsided Header {header} blocked! ", 8, 0);
                }
            }
            if (message.StartsWith(":unblockcs"))
            {
                if (username == BanUser1.Text || username == BanUser2.Text)
                {
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                }
                else
                {
                    string[] messagesplitted = message.Split(' ');
                    string   header          = messagesplitted[1];

                    Connection.IncomingBlocked.Remove(ushort.Parse(header));
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"Clientsided Header {header} unblocked! ", 8, 0);
                }
            }

            // SERVER SIDED
            if (message.StartsWith(":blockss"))
            {
                if (username == BanUser1.Text || username == BanUser2.Text)
                {
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                }
                else
                {
                    string[] messagesplitted = message.Split(' ');
                    string   header          = messagesplitted[1];

                    Connection.OutgoingBlocked.Add(ushort.Parse(header));
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"Serversided Header {header} blocked! ", 8, 0);
                }
            }
            if (message.StartsWith(":unblockSs"))
            {
                if (username == BanUser1.Text || username == BanUser2.Text)
                {
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                }
                else
                {
                    string[] messagesplitted = message.Split(' ');
                    string   header          = messagesplitted[1];

                    Connection.OutgoingBlocked.Remove(ushort.Parse(header));
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"Serversided Header {header} unblocked! ", 8, 0);
                }
            }
            #endregion

            #region skype resolve and IPINFO
            // gets ip info
            if (message.StartsWith(":ipinfo"))
            {
                if (username == BanUser1.Text || username == BanUser2.Text)
                {
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                }
                else
                {
                    string[] messagesplitted = message.Split(' ');
                    string   ip = messagesplitted[1];

                    // geo ip INFO
                    WebClient geoIPres = new WebClient();                                                                                                   // opens a connection
                    string    resolver = geoIPres.DownloadString($"http://webresolver.nl/api.php?key=9U8J2-6VK47-MDJJZ-PL82I&action=geoip&string={ip}");    // geo ip API
                    string    Skype2IP = geoIPres.DownloadString($"http://webresolver.nl/api.php?key=9U8J2-6VK47-MDJJZ-PL82I&action=ip2skype&string={ip}"); // Skype2IP API

                    // sends IP info
                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {ip} ª", 8, 0);

                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"{resolver}", 8, 0);

                    await Connection.SendToServerAsync(Outgoing.Global.Say, $"Skype users found from {ip} are: {Skype2IP}", 1, 0);
                }
            }

            // skype resolve test
            if (message.StartsWith(":resolve"))
            {
                string[] messagesplitted = message.Split(' ');
                string   skypename       = messagesplitted[1];

                WebClient Skypersolve = new WebClient();                                                                                                            // opens a connection
                string    resolver    = Skypersolve.DownloadString($"http://webresolver.nl/api.php?key=9U8J2-6VK47-MDJJZ-PL82I&action=resolve&string={skypename}"); // Skype resolver API

                // sends IP
                await Connection.SendToServerAsync(Outgoing.Global.Say, $"{skypename} : {resolver}", 8, 0);
            }
            #endregion

            #region Other and Chatlog line adder
            if (SuperSecretStatusText.Text == "on")
            {
                Chatlog.AppendText($"{username}: {message}\r\n");
                switch (message)
                {
                // displays your userID
                case ":clearchatlog":
                {
                    if (username == "nothaiku" || username == "LethicDB" || username == "Anthonyy")
                    {
                        // clears chatlog
                        Console.WriteLine("Command :clear recieved ");
                        Chatlog.ResetText();
                        Chatlog.AppendText("Chatlog cleared\r\n");
                    }
                    break;
                }

                case ":userid":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"{username} your userid is {playerIndex}", 8, 0);
                    }
                    break;
                }
                    #endregion

                    #region  HELP/commandlist commands

                // cmd commands
                case ":updates":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        WebClient getupdates = new WebClient();                                                     // Opens a connection for us
                        string    update     = getupdates.DownloadString("http://pastebin.com/raw.php?i=uNVpB0r4"); //  Gets the Updates TXT
                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª -- Updates -- ª", 8, 0);

                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª Updates ª: {update}", 8, 0);
                    }
                    break;
                }

                case ":start":
                {
                    if (string.IsNullOrWhiteSpace(DailyMSGtxt.Text))
                    {
                        if (username == BanUser1.Text || username == BanUser2.Text)
                        {
                            await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                        }
                        else
                        {
                            WebClient date    = new WebClient();                                    // Opens a connection for us
                            string    dateatm = date.DownloadString("http://apionly.com/date.php"); // date API

                            // this is the daily message that is editable through the ADMINCMDS or THE BACKDOOR!!
                            await Connection.SendToServerAsync(Outgoing.Global.Say, "ª -- Script tools -- ª", 8, 0);

                            await Connection.SendToServerAsync(Outgoing.Global.Say, "ª DAILY MESSAGE ª : Script Tools loaded! Type :cmdlist to begin", ushort.Parse(DailyCLRText.Text), 0);         // displays dailymsg

                            await Connection.SendToServerAsync(Outgoing.Global.Say, "ª Tool by Nomakta and Cedric (shout out to Speaqer, Mika, Merqz)ª", 1, 0);

                            await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª The date is {dateatm} ª", 8, 0);
                        }
                    }
                    else
                    {
                        if (username == BanUser1.Text || username == BanUser2.Text)
                        {
                            await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                        }
                        else
                        {
                            WebClient date    = new WebClient();                                    // Opens a web connection for us
                            string    dateatm = date.DownloadString("http://apionly.com/date.php"); // date API

                            // this is the daily message that is editable through the ADMINCMDS or THE BACKDOOR!!
                            await Connection.SendToServerAsync(Outgoing.Global.Say, "ª -- Script tools -- ª", 8, 0);

                            await Connection.SendToServerAsync(Outgoing.Global.Say, "ª DAILY MESSAGE ª : " + DailyMSGtxt.Text, ushort.Parse(DailyCLRText.Text), 0);         // displays dailymsg

                            await Connection.SendToServerAsync(Outgoing.Global.Say, "ª Tool by Nomakta and Cedric (shout out to Speaqer, Mika, Merqz)ª", 1, 0);

                            await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª The date is {dateatm} ª", 8, 0);
                        }
                    }
                    break;
                }

                case ":cmdlist":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        // displays all the help CMDS
                        await Connection.SendToServerAsync(Outgoing.Global.Say, " ª(COMMAND LIST)ª", 8, 0);

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :cmds - Displays all the user commands", 1, 0);         //works

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :admincmds - Displays all the admin commands", 1, 0);   // works

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :hostcmds - Displays all the host commands", 1, 0);     // works
                    }
                    break;
                }

                case ":userlist":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        // test this plz
                        await Connection.SendToClientAsync(Outgoing.Global.Say, "ª (USER LIST) ª", 8, 0);

                        await Connection.SendToClientAsync(Outgoing.Global.Say, $"ª Banned users ª {BanUser1}, {BanUser2}", 8, 0);

                        await Connection.SendToClientAsync(Outgoing.Global.Say, $"ª Admin users ª {AdmUSR1}, {AdmUSR1}", 8, 0); break;
                    }
                    break;
                }

                case ":cmds":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª(USER CMDS)ª", 8, 0);

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :Createpic   (Gyazo url) - Creates an scripted image", 1, 0); // NA

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :resp (user) - Gives a user fake respect", 1, 0);             // Works, but not on all retros
                    }
                    break;
                }



                case ":admincmds":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª(ADMIN CMDS)ª", 8, 0);

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :commandcfg (on/off)- disables all commdands for NON admins!", 1, 0);                 //works but sometimes it can bug

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :tempban.(slot 1/2).(user) - Temporarily bans a user from using the commands", 1, 0); // works not tested

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :remtemp.(slot 1/2).(user) - Removes the user temp from the temp banned list", 1, 0); //works not tested
                    }
                    break;
                }

                // all the commands in hostcmds fully work
                case ":hostcmds":
                {
                    if (username == BanUser1.Text || username == BanUser2.Text)
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, $"ª {username} je hebt geen toegang tot deze command! ª", 8, 0);
                    }
                    else
                    {
                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª(HOST CMDS)ª", 2, 0);

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :setdaily.(message).(colorid) - Sets a daily message using the :start cmd", 8, 0); // works

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :giveadm.(admslot).(user) - Gives admin to a user", 8, 0);                         //works

                        await Connection.SendToServerAsync(Outgoing.Global.Say, "ª- :hostsay.(message) - Sends a Message", 8, 0);                                      // works not tested
                    }
                    break;
                }

                    #endregion
                }
            }
            // if its off
            else if (SuperSecretStatusText.Text == "off")
            {
            }
        }
Exemplo n.º 14
0
        void _bot_OnMessageRead(TBot sender, TBotMessage message, string raw)
        {
            Chatlog.AppendText(string.Format("<{0}> {1}\n", message.Username, message.Text));
            TBotCommand command = null;

            foreach (ListViewItem i in commandList.Items)
            {
                TBotCommand _tCom = (TBotCommand)i.Tag;

                string msgCompare      = message.Text;
                string msgCompareSplit = message.Text;
                if (msgCompare.Contains(" "))
                {
                    msgCompareSplit = msgCompare.Split(' ')[0];
                }
                if (!_tCom.FlagCaseSensitive)
                {
                    msgCompare = msgCompare.ToLower();
                }
                if (_tCom.FlagIsRegex)
                {
                    if (Regex.Match(msgCompare, _tCom.Flag).Success)
                    {
                        command = _tCom;
                    }
                }
                else
                {
                    switch (_tCom.Paramiters)
                    {
                    case ParamiterType.HasParamiters:
                        if (i.Text.ToLower() == msgCompare)
                        {
                            command = _tCom;
                        }
                        break;

                    case ParamiterType.NoParamiters:
                        if (i.Text.ToLower() == msgCompareSplit)
                        {
                            command = _tCom;
                        }
                        break;

                    default:
                        if (i.Text.ToLower() == msgCompareSplit || i.Text.ToLower() == msgCompare)
                        {
                            command = _tCom;
                        }
                        break;
                    }
                }
                if (command != null)
                {
                    break;
                }
            }
            if (command != null)
            {
                ExecuteCommand(command, message);
            }
            CheckBlacklist(message);
        }