✨ Added shuffle and hilo commands
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -153,6 +153,7 @@ token.txt
|
|||||||
resources/swcharacters.json
|
resources/swcharacters.json
|
||||||
resources/games/games.json
|
resources/games/games.json
|
||||||
resources/games/blackjackCards.txt
|
resources/games/blackjackCards.txt
|
||||||
|
resources/games/hilo.txt
|
||||||
resources/destinyPoints.txt
|
resources/destinyPoints.txt
|
||||||
resources/games/blackjackTables/
|
resources/games/blackjackTables/
|
||||||
resources/games/4InARowBoards/
|
resources/games/4InARowBoards/
|
||||||
|
20
Gwendolyn.py
20
Gwendolyn.py
@ -475,6 +475,18 @@ async def parseCommands(message,content):
|
|||||||
|
|
||||||
await message.channel.send(response)
|
await message.channel.send(response)
|
||||||
|
|
||||||
|
# Returning current hi-lo value
|
||||||
|
elif content.startswith("blackjack hilo") and message.author.display_name == "Nikolaj":
|
||||||
|
with open("resources/games/hilo.txt", "r") as f:
|
||||||
|
data = f.read()
|
||||||
|
await message.channel.send(data)
|
||||||
|
|
||||||
|
# Shuffles the blackjack deck
|
||||||
|
elif content.startswith("blackjack shuffle"):
|
||||||
|
blackjackShuffle(blackjackDecks)
|
||||||
|
logThis("Shuffling the blackjack deck...")
|
||||||
|
await message.channel.send("Shuffling the deck...")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
await message.channel.send("I didn't quite understand that")
|
await message.channel.send("I didn't quite understand that")
|
||||||
|
|
||||||
@ -513,14 +525,14 @@ async def on_ready():
|
|||||||
# Reads messages and tests if they are Gwendolyn commands
|
# Reads messages and tests if they are Gwendolyn commands
|
||||||
@client.event
|
@client.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
try:
|
#try:
|
||||||
content = message.content
|
content = message.content
|
||||||
if content.startswith(commandPrefix):
|
if content.startswith(commandPrefix):
|
||||||
logThis(message.author.display_name+" ran \""+content+"\"")
|
logThis(message.author.display_name+" ran \""+content+"\"")
|
||||||
await parseCommands(message,content.lower()[1:])
|
await parseCommands(message,content.lower()[1:])
|
||||||
except:
|
#except:
|
||||||
logThis("Something fucked up (error code 000)")
|
# logThis("Something fucked up (error code 000)")
|
||||||
await message.channel.send("Something fucked up (error code 000)")
|
# await message.channel.send("Something fucked up (error code 000)")
|
||||||
|
|
||||||
# Is a bit sassy sometimes
|
# Is a bit sassy sometimes
|
||||||
if ("gwendolyn" in message.content.lower() or message.content.startswith(commandPrefix)) and any(x in message.content.lower() for x in meanWords) and "ikke" not in message.content.lower() and "not" not in message.content.lower():
|
if ("gwendolyn" in message.content.lower() or message.content.startswith(commandPrefix)) and any(x in message.content.lower() for x in meanWords) and "ikke" not in message.content.lower() and "not" not in message.content.lower():
|
||||||
|
@ -56,12 +56,23 @@ def drawCard():
|
|||||||
logThis("drawing a card")
|
logThis("drawing a card")
|
||||||
with open("resources/games/blackjackCards.txt","r") as f:
|
with open("resources/games/blackjackCards.txt","r") as f:
|
||||||
cards = f.read().split("\n")
|
cards = f.read().split("\n")
|
||||||
|
with open("resources/games/hilo.txt", "r") as f:
|
||||||
|
data = int(f.read())
|
||||||
|
|
||||||
drawnCard = cards.pop(0)
|
drawnCard = cards.pop(0)
|
||||||
data = "\n".join(cards)
|
deck = "\n".join(cards)
|
||||||
|
|
||||||
|
value = calcHandValue([drawnCard])
|
||||||
|
|
||||||
|
if value <= 6:
|
||||||
|
data += 1
|
||||||
|
elif value >= 10:
|
||||||
|
data -= 1
|
||||||
|
|
||||||
with open("resources/games/blackjackCards.txt","w") as f:
|
with open("resources/games/blackjackCards.txt","w") as f:
|
||||||
f.write(data)
|
f.write(deck)
|
||||||
|
with open("resources/games/hilo.txt", "w") as f:
|
||||||
|
f.write(str(data))
|
||||||
|
|
||||||
return drawnCard
|
return drawnCard
|
||||||
|
|
||||||
|
@ -165,6 +165,17 @@ def makeFiles():
|
|||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
# Creates blackjackCards.txt if it doesn't exist
|
||||||
|
try:
|
||||||
|
f = open("resources/games/hilo.txt","r")
|
||||||
|
except:
|
||||||
|
logThis("hilo.txt didn't exist. Making it now.")
|
||||||
|
data = ""
|
||||||
|
with open("resources/games/hilo.txt","w") as f:
|
||||||
|
f.write(data)
|
||||||
|
finally:
|
||||||
|
f.close()
|
||||||
|
|
||||||
# Creates destinyPoints.txt if it doesn't exist
|
# Creates destinyPoints.txt if it doesn't exist
|
||||||
try:
|
try:
|
||||||
f = open("resources/destinyPoints.txt","r")
|
f = open("resources/destinyPoints.txt","r")
|
||||||
|
Reference in New Issue
Block a user