Ejemplo n.º 1
0
 //Performs attempt to claim
 public bool tryClaim(string username)
 {
     if (raffleIsActive())
     {
         if (activeWinner.ToLower() == username.ToLower())
         {
             claimTimer.Stop();
             string entries = "";
             foreach (string entry in enteredViewers)
             {
                 if (entries == "")
                 {
                     entries = entry;
                 }
                 else
                 {
                     entries = entries + "|" + entry;
                 }
             }
             Objects.RaffleWin raffleWin = WebCalls.addRaffleWinner(activeWinner, raffleProperties.Raffle_Name, raffleProperties.Raffle_Donator,
                                                                    entries, raffleProperties.Raffle_Linker, claimCurrentSecond).Result;
             Common.ChatClient.SendMessage(string.Format("GIVEAWAY CLAIMED BY: {0}! You've won {1} raffles, and entered {2} (that's a win percentage of {3}%). Your claim time was {4} seconds," +
                                                         " however your average claim time is {5} seconds.", raffleWin.Winner, raffleWin.WinCount, raffleWin.EnterCount, raffleWin.WinPercentage, raffleWin.ClaimTime, raffleWin.ClaimTimeAvg), Common.DryRun);
             sendWinnerWhisper();
             if (raffleProperties.Raffle_Type == Common.GiveawayTypes.SOUND_BYTES)
             {
                 WebCalls.addSoundbyteCredits(raffleWin.Winner, raffleProperties.Soundbyte_Count);
                 Common.ChatClient.SendMessage(string.Format("[Auto] Added {0} soundbyte credits to {1}'s total.", raffleProperties.Soundbyte_Count, raffleWin.Winner), Common.DryRun);
             }
             int latestID = WebCalls.downloadRaffleID().Result;
             if (raffleProperties.Raffle_Type == Common.GiveawayTypes.EXGAMES)
             {
                 Common.ChatClient.SendMessage(string.Format("Giveaway details can be viewed here: http://burkeblack.tv/giveaways/listing.php?gid={0} .  Video on how automatic !games giveaways work: https://www.twitch.tv/burkeblack/v/30553157", latestID.ToString()));
             }
             else
             {
                 Common.ChatClient.SendMessage(string.Format("Giveaway details can be viewed here: http://burkeblack.tv/giveaways/listing.php?gid={0}", latestID.ToString()), Common.DryRun);
             }
             Common.notify("NEW GIVEAWAY CLAIM", raffleWin.Winner + " claimed " + raffleProperties.Raffle_Name);
             Common.relay(string.Format("NEW CLAIM: Winner: {0}, Name: {1}, Donator: {2}, Author: {3}", raffleWin.Winner, raffleProperties.Raffle_Name, raffleProperties.Raffle_Donator, raffleProperties.Raffle_Author));
             Common.CommandQueue.checkQueueOnce();
             return(true);
         }
         else
         {
             System.Threading.Thread.Sleep(400);
             Common.ChatClient.SendMessage(string.Format("*WARNING* [{0}] Timed out for {1} hours. [Invalid Claim])", username, invalidClaimTimeoutHours.ToString()), Common.DryRun);
             if (Common.WhisperClient != null)
             {
                 Common.WhisperClient.SendWhisper(username, string.Format("You have been timedout for {0} hours.  Do NOT try to claim a giveaway that you did not win.", invalidClaimTimeoutHours.ToString()), Common.DryRun);
             }
             Common.ChatClient.SendMessage(string.Format(".timeout {0} {1}", username, TimeoutConverter.Hours(invalidClaimTimeoutHours)), Common.DryRun);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
        // Performs a GET request with giveaway details to BurkeBlack.TV
        public async static Task <Objects.RaffleWin> addRaffleWinner(string winner, string raffleName, string donator, string entries, string linker, int claimSeconds)
        {
            List <KeyValuePair <string, string> > args = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("winner", winner),
                new KeyValuePair <string, string>("game", raffleName),
                new KeyValuePair <string, string>("donator", donator),
                new KeyValuePair <string, string>("linker", linker),
                new KeyValuePair <string, string>("claimtime", claimSeconds.ToString()),
                new KeyValuePair <string, string>("entries", entries)
            };
            JToken raffleServerDetails = JObject.Parse(await request(requestType.POST, Properties.Settings.Default.webAddRaffleWinner, args)).SelectToken("raffle_win");

            Objects.RaffleWin raffleWin = new Objects.RaffleWin(raffleServerDetails);
            return(raffleWin);
        }
Ejemplo n.º 3
0
 // Performs a GET request with giveaway details to BurkeBlack.TV 
 public async static Task<Objects.RaffleWin> addRaffleWinner(string winner, string raffleName, string donator, string entries, string linker, int claimSeconds)
 {
     List<KeyValuePair<string, string>> args = new List<KeyValuePair<string, string>>()
     {
         new KeyValuePair<string, string>("winner", winner),
         new KeyValuePair<string, string>("game", raffleName),
         new KeyValuePair<string, string>("donator", donator),
         new KeyValuePair<string, string>("linker", linker),
         new KeyValuePair<string, string>("claimtime",claimSeconds.ToString()),
         new KeyValuePair<string, string>("entries", entries)
     };
     JToken raffleServerDetails = JObject.Parse(await request(requestType.POST, Properties.Settings.Default.webAddRaffleWinner, args)).SelectToken("raffle_win");
     Objects.RaffleWin raffleWin = new Objects.RaffleWin(raffleServerDetails);
     return raffleWin;
 }