Пример #1
0
        private async Task BannedWordsDrop(SocketMessage msg)
        {
            SocketUserMessage message = msg as SocketUserMessage;
            string            msgsent = message.ToString().ToLower();
            SocketGuildUser   author  = message.Author as SocketGuildUser;
            SocketUser        user    = author as SocketUser;

            //string[] badWords = File.ReadAllLines(@"BannedWords.txt");
            if (badWords.Any(msgsent.Contains))
            {
                Console.WriteLine("Banned Phrase Detected!");
                Console.WriteLine($"User: {msg.Author.Username}");
                Console.WriteLine($"Phrase: {msg.Content}");

                //ban time constant represents 2 min, not 2 milliseconds. Make sure that the timer creation compensates
                UserAccounts.AddAccountBanCount(user);
                ulong banTimeC = 300000 + UserAccounts.GetAccountBanCount(user) * 60000;
                var   role     = author.Guild.Roles.FirstOrDefault(x => x.Name.ToString() == "Being Dropped Out of a Helicopter");
                Console.WriteLine("Dropping user...");
                await author.AddRoleAsync(role);

                await msg.Channel.SendMessageAsync("", false, Misc.CreateHeliDropEmbed(user.Username, "Helibot Automatic Detection Service", true, msg.ToString(), "Banned Word Detected", banTimeC));

                Console.WriteLine("User Dropped!");
                Console.WriteLine("Initializing AutoLanding Service");
                DropTimer Countdown = new DropTimer();
                Countdown.SetComponents(author, message, banTimeC);
                Countdown.InitTimer();
                Countdown.TimerElapsed += CountDownElapsed;
                //Countdown.ClockElapsed += CountDownClockElapsed;
                Console.WriteLine("AutoLanding Service initialized.");
            }
        }
 void DropItem()
 {
     Player                   = null;
     PlayerRigidBody          = null;
     ThisRigidbody.useGravity = true;
     ThisRigidbody.ResetInertiaTensor();
     ThisRigidbody.constraints = RigidbodyConstraints.None;
     DropTimer.StartTimer(PickupDelay, 1, PickUpReset);
 }
 override public void Interact(GameObject player)
 {
     if (Player == null && CanBePickedUp == true)
     {
         Player                   = player.GetComponentInChildren <Camera>().gameObject;
         PlayerRigidBody          = player.GetComponent <Rigidbody>();
         ThisRigidbody.useGravity = false;
         CanBePickedUp            = false;
         CanBeDropped             = false;
         DropTimer.StartTimer(PickupDelay, 1, DropReset);
         transform.rotation = StartingOrientation;
     }
 }