コード例 #1
0
        public static void BetCommand(string speaker, int betAmount)
        {
            if (UserHandler.GetPointsFromUser(speaker) < betAmount)
            {
                ChatLink.SendTwitchMessage("Can't bet with points you don't have 4Head");
                return;
            }
            ChatLink.SendTwitchMessage($"{speaker} bets with {betAmount}");

            var bet = r.Next(0, 100) + 1;

            if (bet > 50)
            {
                ChatLink.SendTwitchMessage($"{speaker} rolled a {bet} and wins! {betAmount} added to points. " +
                                           $"Current amount: {UserHandler.GetPointsFromUser(speaker) + betAmount}");
                UserHandler.AddPointsToUser(speaker, betAmount);
            }
            else
            {
                ChatLink.SendTwitchMessage($"{speaker} rolled a {bet} and loses! {betAmount} removed from points. " +
                                           $"Current amount: {UserHandler.GetPointsFromUser(speaker) - betAmount}");
                UserHandler.RemovePointsFromUser(speaker, betAmount);
            }
        }
コード例 #2
0
 private void resetPointsButton_Click(object sender, EventArgs e)
 {
     UserHandler.ClearPoints();
     MessageBox.Show("Points Cleared!", "Clear Points", MessageBoxButtons.OK);
 }
コード例 #3
0
ファイル: MainScreen.cs プロジェクト: RobinGraaf/TwitchBot
 private void pointsTimer_Tick(object sender, EventArgs e)
 {
     UserHandler.AddPointsToAll();
 }