Advertisement
Aareon

Aareon's LDogeCasino bot (broken af)

Dec 8th, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.07 KB | None | 0 0
  1. from util.hook import *
  2. import random
  3. import math
  4. import time
  5.  
  6. me = 'LDogeCasino'
  7. flip = 'flip'
  8. bJ = 'blackjack'
  9. doGamble = 0
  10. tipbotName = 'LDoge-Tipbot'
  11. checkTimeOld = ''
  12.  
  13. # !log
  14.  
  15. @hook(cmds=["log"],isTrusted=True)
  16. def sayLog(code, input):
  17.     tipbot = code.chan["#litedoge-casino"][tipbotName]
  18.     check = [i['time'] for i in tipbot['messages']][-1]
  19.     print(check)
  20.  
  21.  
  22. @hook(rule=r'.*tipped '+me)
  23. def tip(code, input):
  24. ##Begin new verify
  25.     if "#litedoge-casino" in input.channel:
  26.         if tipbotName in input.nick:
  27.             if me in input:
  28.                 inp = input.split(' ')
  29.                 betAmt = float(inp[3])
  30.                 betNick = inp[8]
  31.                 betNickLog = code.chan["#litedoge-casino"][betNick]
  32.                 checkMsg = [i['message'] for i in betNickLog['messages']][-1]
  33.                 msg = checkMsg.split(' ')
  34.                 try:
  35.                     if "flip" in msg[3].lower():
  36.                         betFace = msg[4]
  37.                         if betAmt > 1000:
  38.                             flip(code,betNick,betAmt,betFace)
  39.                         else:
  40.                             code.say("!tip "+betNick+" "+str(betAmt))
  41.                             code.say(betNick+": Maximum bet is 1000")
  42.                             code.say("!tip "+betNick+" "+str(betAmt))
  43.                             return()
  44.                     if msg[3].lower() in ['donate','donation']:
  45.                         code.say('{red}'+betNick+': Thanks for the donation!')
  46.                     else:
  47.                         code.say("{red}"+betNick+": That's not a game, silly.")
  48.                 except IndexError:
  49.                     code.say("{red}"+betNick+": Looks like you're missing something. Try !games")
  50.                     code.say('!tip '+betNick+' '+str(betAmt))
  51.             #game is [3], last param is [4]
  52.  
  53.             #Get value of tip and sender
  54.             #Set chanlog to a variable
  55.             #Get last message of sender (i)
  56.             #If last message of sender contains tip value then
  57.             #Get bet parameters (flip, blackjack, bomb, etc.)
  58.             #Else check last message (i) -1
  59.             #If input.nick is not tipbotName, return()
  60. ###End new verify
  61.  
  62.  
  63. ##Begin old verify
  64.     #tipbot = code.chan["#litedoge-casino"][tipbotName]
  65.     #user = code.chan["#litedoge-casino"][input.nick]
  66. #
  67.     #tipbotMessage = [i['message'] for i in tipbot['messages']][-1]
  68. #
  69.     #userMessageTime = [i['time'] for i in tipbot['messages']][-1]
  70.     #tipbotMessageTime = [i['time'] for i in tipbot['messages']][-1]
  71. #
  72.     #while tipbotMessageTime < userMessageTime:
  73.     #   tipbot = code.chan["#litedoge-casino"][tipbot] #refresh the list
  74.     #   tipbotMessageTime = [i['time'] for i in tipbot['messages']][-1] #get time of last message
  75.     #   tipbotMessage = [i['message'] for i in tipbot['messages']][-1] #refresh last message to use next
  76. #
  77.     #if tipbotMessageTime >= userMessageTime:
  78.     #   if input.nick + "tipped LDogeCasino" in tipbotMessage:
  79.     #       code.reply("Yay!")
  80. ###End verification
  81.  
  82. def flip(code,betNick,betAmt,betFace):
  83.     coin = random.randint(1,2)
  84.     if coin == 1:
  85.         landFace = "heads"
  86.     else:
  87.         landFace = "tails"
  88.     toWin = (betAmt*.3)*.98
  89.     betTotal = betAmt+toWin
  90.     if betFace in landFace:
  91.         code.say("You bet "+str(betAmt)+" ldoge on "+betFace+". The coin landed on "+landFace+". You win "+str(toWin)+"!")
  92.         code.say("!tip "+betNick+" "+str(betTotal))
  93.         doGamble = 1
  94.     else:
  95.         code.say("You bet "+str(betAmt)+" ldoge on "+betFace+". The coin landed on "+landFace)
  96.         doGamble = 1
  97.  
  98. #boobs are nice
  99. #['boobs','are','nice']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement