Just a little betting script I wrote in python for help with betting “coins” on the AutoHotkey discord guild. It takes the coins you input and divides it into best possible low, medium and high bets. Along with this, it will store the bets into a SQL database, and then it will allow you to set a timed reminder for your next bet which will open a youtube video in the browser when the time is up. Some of the functions and modules may not be used in this version.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
#Betting Buddy Ver 3.1 #ozzhates '19 count = 0 #Imports (not from china) import datetime, math, subprocess, os, sqlite3, pyperclip, time, winsound, tkinter, random, webbrowser, pyautogui #Pyautogui pause n failsafe pyautogui.PAUSE = 1 pyautogui.FAILSAFE = True while True: count += 1 if count >=50: break #Golobal Time currentDT = datetime.datetime.now() #Redundent Var Clearing Coins = 0 #User Input Coins Coins = input("how many jawns ya'll got?") Coins = int(Coins) Bet1 = ((Coins) / (5)) Bet2 = ((Coins) / (4.5)) Bet3 = ((Coins) / (4)) print(round(Coins, 0), "User coins input") print(round(Bet1, 0), "Min bet 1/5") print(round(Bet2, 0), "Mid bet") print(round(Bet3, 0), "High bet 1/4") #Lost Bets Lost15 = ((Coins) - (Bet1)) LostMid = ((Coins) - (Bet2)) LostBtm = ((Coins) - (Bet3)) print(round(Lost15, 0), "Left after min") print(round(LostMid, 0), "Left after mid") print(round(LostBtm, 0), "Left after high") #Fucking with time def WriteTxtFile(): currentDT = datetime.datetime.now() print (currentDT.strftime("%Y-%m-%d %H:%M:%S")) #write time with filename with open ((currentDT.strftime("(%Y-%m-%d) (%H-%M-%S )")) + 'BetttingBuddy.txt', 'w+') as f: #Current Coins f.write("Current Coins ") f.write(str(round(Coins, 0))) f.write("\n") f.write("\n") f.write("Your possible bets:") f.write("\n") f.write("\n") #Min f.write("Min Bet ") f.write(str(round(Bet1, 0))) f.write("\n") #Mid f.write("Mid Bet ") f.write(str(round(Bet2, 0))) f.write("\n") #High f.write("High Bet ") f.write(str(round(Bet3, 0))) f.write("\n") f.write("\n") f.write("\n") #Lost Bet Totals f.write("If lost bets:") f.write("\n") f.write("\n") #Lost15 f.write("Min bet ") f.write(str(round(Lost15, 0))) f.write("\n") #Lost Mid f.write("Mid bet ") f.write(str(round(LostMid, 0))) f.write("\n") #Lost High f.write("High bet ") f.write(str(round(LostBtm, 0))) f.write("\n") f.close() def OpenDiscord(): #Open discord #discord path dcrpath = "C:/Users/User/AppData/Local/Discord/app-0.0.304/" #discord exe path and subprocess Popen dcrePath = r'C:\Users\User\AppData\Local\Discord\app-0.0.304\Discord.exe' subprocess.Popen("%s %s" % (dcrePath, dcrpath)) def OpenTxtFile(): #Local time call currentDT = datetime.datetime.now() #Open the file we created #text path txtpath = "C:/Users/User/Desktop/py/Betting/" + (str(currentDT.strftime("(%Y-%m-%d) (%H-%M-%S )")) + 'BetttingBuddy.txt') #notepad path Popen npadPath = r'C:\Windows\System32\notepad.exe' subprocess.Popen("%s %s" % (npadPath, txtpath)) def PrintDi(): #Print working dir print("Working DIR") di = os.getcwd() #os.chdir() #change dir cmd print(di) #ABS SetPath Printing print(txtpath) #npad Path Printing print(npadPath) #sqllite3 testing conn = sqlite3.connect('Bets.db') c = conn.cursor() #First Time Table Creation def FirstTable(): c.execute('''CREATE TABLE Bets2 (Time_Of_Bet TEXT, Current_Coins INTEGER, PossibleBets TEXT, MinBet INTEGER, MidBet INTEGER, HighBet INTEGER, If_you_lost TEXT, LostMin INTEGER, LostMid INTEGER, LostHigh INTEGER) ''') #Write To The DB def WriteValues(): c.execute("INSERT INTO Bets VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (currentDT, Coins , 'Possible Bets' , Bet1 , Bet2 , Bet3 ,'Lost Bets',Lost15, LostMid, LostBtm)) conn.commit() conn.close() #Copy Low Bet to clipboard clip = str(".bet") + str(" ") + str(Bet1) pyperclip.copy(clip) print(clip) WriteValues() def AlarmClock(): """ https://github.com/Jabromen/Python-Alarm-Clock Simple Python script to set an alarm for a specific time. When the alarm goes off, a random youtube video will be opened. The possible youtube video URLs are taken from "youtube_alarm_videos.txt" """ # If video URL file does not exist, create one if not os.path.isfile("youtube_alarm_videos.txt"): print('Creating "youtube_alarm_videos.txt"...') with open("youtube_alarm_videos.txt", "w") as alarm_file: alarm_file.write("https://youtu.be/JGCsyshUU-A") #Shadows - Lindsey Stirling (Original Song) #alarm_file.write("https://www.youtube.com/watch?v=XbGs_qK2PQA")#eminem "Rap God" def check_alarm_input(alarm_time): """Checks to see if the user has entered in a valid alarm time""" if len(alarm_time) == 1: # [Hour] Format if alarm_time[0] < 24 and alarm_time[0] >= 0: return True if len(alarm_time) == 2: # [Hour:Minute] Format if alarm_time[0] < 24 and alarm_time[0] >= 0 and \ alarm_time[1] < 60 and alarm_time[1] >= 0: return True elif len(alarm_time) == 3: # [Hour:Minute:Second] Format if alarm_time[0] < 24 and alarm_time[0] >= 0 and \ alarm_time[1] < 60 and alarm_time[1] >= 0 and \ alarm_time[2] < 60 and alarm_time[2] >= 0: return True return False # Get user input for the alarm time now = datetime.datetime.now() print("Time as of now.") print(now) print("Set a time for the alarm (Ex. 06:30 or 18:30:00)") while True: alarm_input = input(">> ") try: alarm_time = [int(n) for n in alarm_input.split(":")] if check_alarm_input(alarm_time): break else: raise ValueError except ValueError: print("ERROR: Enter time in HH:MM or HH:MM:SS format") # Convert the alarm time from [H:M] or [H:M:S] to seconds seconds_hms = [3600, 60, 1] # Number of seconds in an Hour, Minute, and Second alarm_seconds = sum([a*b for a,b in zip(seconds_hms[:len(alarm_time)], alarm_time)]) # Get the current time of day in seconds now = datetime.datetime.now() current_time_seconds = sum([a*b for a,b in zip(seconds_hms, [now.hour, now.minute, now.second])]) # Calculate the number of seconds until alarm goes off time_diff_seconds = alarm_seconds - current_time_seconds # If time difference is negative, set alarm for next day if time_diff_seconds < 0: time_diff_seconds += 86400 # number of seconds in a day # Display the amount of time until the alarm goes off print("Alarm set to go off in %s" % datetime.timedelta(seconds=time_diff_seconds)) # Sleep until the alarm goes off time.sleep(time_diff_seconds) # Time for the alarm to go off print("Wake Up!") # Load list of possible video URLs with open("youtube_alarm_videos.txt", "r") as alarm_file: videos = alarm_file.readlines() # Open a random video from the list webbrowser.open(random.choice(videos)) #Print print(now) AlarmClock() def WinBeep1(): duration = 2000#S freq = 1800 #Hz winsound.Beep(freq, duration) WinBeep1() def WinBeep2(): winsound.PlaySound("*", winsound.SND_ALIAS) WinBeep2() OpenDiscord() #Loop if count <=50: continue |