Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from util.hook import *
- import random
- import math
- import time
- me = 'LDogeCasino'
- flip = 'flip'
- bJ = 'blackjack'
- doGamble = 0
- tipbotName = 'LDoge-Tipbot'
- checkTimeOld = ''
- # !log
- @hook(cmds=["log"],isTrusted=True)
- def sayLog(code, input):
- tipbot = code.chan["#litedoge-casino"][tipbotName]
- check = [i['time'] for i in tipbot['messages']][-1]
- print(check)
- @hook(rule=r'.*tipped '+me)
- def tip(code, input):
- ##Begin new verify
- if "#litedoge-casino" in input.channel:
- if tipbotName in input.nick:
- if me in input:
- inp = input.split(' ')
- betAmt = float(inp[3])
- betNick = inp[8]
- betNickLog = code.chan["#litedoge-casino"][betNick]
- checkMsg = [i['message'] for i in betNickLog['messages']][-1]
- msg = checkMsg.split(' ')
- try:
- if "flip" in msg[3].lower():
- betFace = msg[4]
- if betAmt > 1000:
- flip(code,betNick,betAmt,betFace)
- else:
- code.say("!tip "+betNick+" "+str(betAmt))
- code.say(betNick+": Maximum bet is 1000")
- code.say("!tip "+betNick+" "+str(betAmt))
- return()
- if msg[3].lower() in ['donate','donation']:
- code.say('{red}'+betNick+': Thanks for the donation!')
- else:
- code.say("{red}"+betNick+": That's not a game, silly.")
- except IndexError:
- code.say("{red}"+betNick+": Looks like you're missing something. Try !games")
- code.say('!tip '+betNick+' '+str(betAmt))
- #game is [3], last param is [4]
- #Get value of tip and sender
- #Set chanlog to a variable
- #Get last message of sender (i)
- #If last message of sender contains tip value then
- #Get bet parameters (flip, blackjack, bomb, etc.)
- #Else check last message (i) -1
- #If input.nick is not tipbotName, return()
- ###End new verify
- ##Begin old verify
- #tipbot = code.chan["#litedoge-casino"][tipbotName]
- #user = code.chan["#litedoge-casino"][input.nick]
- #
- #tipbotMessage = [i['message'] for i in tipbot['messages']][-1]
- #
- #userMessageTime = [i['time'] for i in tipbot['messages']][-1]
- #tipbotMessageTime = [i['time'] for i in tipbot['messages']][-1]
- #
- #while tipbotMessageTime < userMessageTime:
- # tipbot = code.chan["#litedoge-casino"][tipbot] #refresh the list
- # tipbotMessageTime = [i['time'] for i in tipbot['messages']][-1] #get time of last message
- # tipbotMessage = [i['message'] for i in tipbot['messages']][-1] #refresh last message to use next
- #
- #if tipbotMessageTime >= userMessageTime:
- # if input.nick + "tipped LDogeCasino" in tipbotMessage:
- # code.reply("Yay!")
- ###End verification
- def flip(code,betNick,betAmt,betFace):
- coin = random.randint(1,2)
- if coin == 1:
- landFace = "heads"
- else:
- landFace = "tails"
- toWin = (betAmt*.3)*.98
- betTotal = betAmt+toWin
- if betFace in landFace:
- code.say("You bet "+str(betAmt)+" ldoge on "+betFace+". The coin landed on "+landFace+". You win "+str(toWin)+"!")
- code.say("!tip "+betNick+" "+str(betTotal))
- doGamble = 1
- else:
- code.say("You bet "+str(betAmt)+" ldoge on "+betFace+". The coin landed on "+landFace)
- doGamble = 1
- #boobs are nice
- #['boobs','are','nice']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement