Exemple #1
0
        public static string Sub()
        {
            Random rng = new Random();

            string[] pool      = Precentage.CheckChance(98) ? Rare : Subscription;
            bool     uppercase = rng.NextDouble() >= 0.5;

            if (uppercase)
            {
                return(pool[rng.Next(0, pool.Length)].ToUpper());
            }
            else
            {
                return(pool[rng.Next(0, pool.Length)]);
            }
        }
Exemple #2
0
 private void Update()
 {
     Update[] updates = GetUpdates();
     foreach (Update update in updates)
     {
         if (update.Message.Text != null)
         {
             ConsoleHelper.WriteLineIf(RunArgs.Verbose, $"[{update.Message.From.Id}]{update.Message.From.FirstName}: {update.Message.Text}");
             if (update.Message.Text.StartsWith("/subscribe"))
             {
                 SubChat(update.Message.Chat.Id);
             }
             else if (update.Message.Text.StartsWith("/unsubscribe"))
             {
                 UnsubChat(update.Message.Chat.Id);
             }
             else if (update.Message.Text.Contains("crab"))
             {
                 SendOutMessages();
             }
             else
             {
                 Feed(update.Message.Text);
                 string[] lines = update.Message.Text.Split(_newlineArray, StringSplitOptions.RemoveEmptyEntries);
                 foreach (string line in lines)
                 {
                     DatabaseAccess.AddMessage(update.Message.Chat.Id, line);
                 }
             }
         }
         Properties.Settings.Default.LastReadMessage = update.Id + 1;
         Properties.Settings.Default.Save();
     }
     if (updates.Length > 0 && Precentage.CheckChance(5))
     {
         SendOutMessages();
     }
 }
Exemple #3
0
        public static string UnSub()
        {
            Random rng = new Random();

            string[] pool;
            if (Precentage.CheckChance(98))
            {
                pool = Rare;
            }
            else
            {
                pool = Unsubscribtion;
            }
            bool uppercase = rng.NextDouble() >= 0.5;

            if (uppercase)
            {
                return(pool[rng.Next(0, pool.Length)].ToUpper());
            }
            else
            {
                return(pool[rng.Next(0, pool.Length)]);
            }
        }