📝 Commenting and formatting
This commit is contained in:
289
Gwendolyn.py
289
Gwendolyn.py
@ -8,38 +8,28 @@ import string
|
||||
import json
|
||||
import random
|
||||
|
||||
import funcs
|
||||
from funcs import *
|
||||
|
||||
funcs.makeFiles()
|
||||
funcs.shuffle()
|
||||
commandPrefix = "!"
|
||||
|
||||
# Gets secret bot token
|
||||
with open("token.txt","r") as f:
|
||||
token = f.read().replace("\n","")
|
||||
# Blackjack shuffle variables
|
||||
blackjackMinCards = 50
|
||||
blackjackDecks = 4
|
||||
|
||||
client = discord.Client()
|
||||
# Variable for reacting to messages
|
||||
meanWords = ["stupid", "bitch", "fuck", "dumb", "idiot"]
|
||||
|
||||
# Logs in
|
||||
@client.event
|
||||
async def on_ready():
|
||||
funcs.logThis("Logged in as "+client.user.name+", "+str(client.user.id))
|
||||
game = discord.Game("Some weeb shit")
|
||||
await client.change_presence(activity=game)
|
||||
|
||||
# Reads messages and tests if they are Gwendolyn commands
|
||||
@client.event
|
||||
async def on_message(message):
|
||||
# Sends the contents of "help.txt"
|
||||
if message.content.lower().startswith("!help"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
if message.content.lower() == "!help" or message.content.lower() == "!help ":
|
||||
async def parseCommands(message,content):
|
||||
# Sends the contents of a help file, as specified by the message.
|
||||
if content.startswith("help"):
|
||||
if content == "help" or content == "help ":
|
||||
with codecs.open("resources/help/help.txt",encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
em = discord.Embed(title = "Help", description = text,colour = 0x59f442)
|
||||
await message.channel.send(embed = em)
|
||||
else:
|
||||
command = message.content.lower().replace(" ","-").replace("!","")
|
||||
funcs.logThis("Looking for "+command+".txt")
|
||||
command = content.replace(" ","-")
|
||||
logThis("Looking for "+command+".txt")
|
||||
try:
|
||||
with codecs.open("resources/help/"+command+".txt",encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
@ -49,13 +39,12 @@ async def on_message(message):
|
||||
await message.channel.send("Couldn't find help for that command")
|
||||
|
||||
# Logs whatever you write in the message
|
||||
if message.content.lower().startswith("!log "):
|
||||
funcs.logThis(message.content.lower().replace("!log ",""))
|
||||
if content.startswith("log "):
|
||||
logThis(content.replace("log ",""))
|
||||
|
||||
# Stops the bot
|
||||
elif message.content.lower().startswith("!stop"):
|
||||
elif content.startswith("stop"):
|
||||
if message.author.display_name == "Nikolaj":
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
await message.channel.send("Logging out...")
|
||||
|
||||
with open("resources/games/games.json","r") as f:
|
||||
@ -70,31 +59,28 @@ async def on_message(message):
|
||||
|
||||
await client.logout()
|
||||
else:
|
||||
funcs.logThis(message.author.display_name+" tried to run "+message.content)
|
||||
logThis(message.author.display_name+" tried to run stop me!")
|
||||
await message.channel.send("I don't think I will, "+message.author.display_name)
|
||||
|
||||
# Does a hello with the helloFunc function from funcs/gwendolynFuncs.py
|
||||
elif message.content.lower().startswith("!hello"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
await message.channel.send(funcs.helloFunc(message.author.display_name))
|
||||
# Does a hello with the helloFunc function from funcs/gwendolynpy
|
||||
elif content.startswith("hello"):
|
||||
|
||||
await message.channel.send(helloFunc(message.author.display_name))
|
||||
|
||||
# Rolls dice with the roll_dice function from funcs/roll/dice.py
|
||||
elif message.content.lower().startswith("!roll"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
if message.content.lower() == "!roll" or message.content.lower() == "!roll ":
|
||||
await message.channel.send(funcs.roll_dice(message.author.display_name))
|
||||
elif content.startswith("roll"):
|
||||
if content == "roll" or content == "roll ":
|
||||
await message.channel.send(roll_dice(message.author.display_name))
|
||||
else:
|
||||
await message.channel.send(funcs.roll_dice(message.author.display_name, message.content.lower().replace("!roll","")))
|
||||
await message.channel.send(roll_dice(message.author.display_name, content.replace("roll","")))
|
||||
|
||||
# Looks up a spell with the spellFunc function from funcs/lookup/lookupFuncs.py
|
||||
elif message.content.lower().startswith("!spell "):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
await message.channel.send(funcs.spellFunc(message.content))
|
||||
# Looks up a spell with the spellFunc function from funcs/lookup/lookuppy
|
||||
elif content.startswith("spell "):
|
||||
await message.channel.send(spellFunc(cap(content.replace("spell",""))))
|
||||
|
||||
# Looks up a monster with the monsterFuncs() from funcs/lookup/lookupFuncs.py
|
||||
elif message.content.lower().startswith("!monster "):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
title, text1, text2, text3, text4, text5 = funcs.monsterFunc(message.content)
|
||||
# Looks up a monster with the monsterFuncs() from funcs/lookup/lookuppy
|
||||
elif content.startswith("monster "):
|
||||
title, text1, text2, text3, text4, text5 = monsterFunc(cap(content.replace("monster","")))
|
||||
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
|
||||
|
||||
# Sends the received information. Seperates into seperate messages if
|
||||
@ -138,22 +124,19 @@ async def on_message(message):
|
||||
await message.channel.send(embed = em5_2)
|
||||
|
||||
# Sends an image of the Senkulpa map
|
||||
elif message.content.lower().startswith("!map"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
elif content.startswith("map"):
|
||||
await message.channel.send("https://i.imgur.com/diMXXJs.jpg")
|
||||
|
||||
# Finds a random image on the internet with the imageFuncs function from
|
||||
# funcs/gwendolynFuncs.py
|
||||
elif message.content.lower().startswith("!image"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
await message.channel.send(funcs.imageFunc())
|
||||
# funcs/gwendolynpy
|
||||
elif content.startswith("image"):
|
||||
await message.channel.send(imageFunc())
|
||||
|
||||
# Sends information about a random movie with the movieFunc function from
|
||||
# funcs/other/movie.py
|
||||
elif message.content.lower().startswith("!movie"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
elif content.startswith("movie"):
|
||||
async with message.channel.typing():
|
||||
title, plot, cover, cast = funcs.movieFunc()
|
||||
title, plot, cover, cast = movieFunc()
|
||||
if title == "error":
|
||||
await message.channel.send("An error occurred. Try again")
|
||||
else:
|
||||
@ -163,50 +146,44 @@ async def on_message(message):
|
||||
await message.channel.send(embed = embed)
|
||||
|
||||
# Generates a random name with the nameGen function from funcs/other/generators.py
|
||||
elif message.content.lower().startswith("!name"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
await message.channel.send(funcs.nameGen())
|
||||
elif content.startswith("name"):
|
||||
await message.channel.send(nameGen())
|
||||
|
||||
# Generates a random tavern name with the tavernGen function from funcs/other/generators.py
|
||||
elif message.content.lower().startswith("!tavern"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
await message.channel.send(funcs.tavernGen())
|
||||
elif content.startswith("tavern"):
|
||||
await message.channel.send(tavernGen())
|
||||
|
||||
# Changes the "Playing this game" thing in Discord
|
||||
elif message.content.lower().startswith("!game "):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
gamePlaying = funcs.cap(message.content.lower().replace("!game ",""))
|
||||
elif content.startswith("game "):
|
||||
gamePlaying = cap(content.replace("game ",""))
|
||||
game = discord.Game(gamePlaying)
|
||||
await client.change_presence(activity=game)
|
||||
|
||||
# Rolls star wars dice with the parseRoll function from funcs/swfuncs/swroll.py
|
||||
elif message.content.lower().startswith("!swroll"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
command = funcs.cap(message.content.lower().replace("!swroll",""))
|
||||
newMessage = funcs.parseRoll(message.author.display_name,command)
|
||||
elif content.startswith("swroll"):
|
||||
command = cap(content.replace("swroll",""))
|
||||
newMessage = parseRoll(message.author.display_name,command)
|
||||
messageList = newMessage.split("\n")
|
||||
for messageItem in messageList:
|
||||
await message.channel.send(messageItem)
|
||||
|
||||
# Deals with Destiny Points and stuff
|
||||
elif message.content.lower().startswith("!swd"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
command = message.content.lower().replace("!swd","")
|
||||
newMessage = funcs.parseDestiny(message.author.display_name,command)
|
||||
elif content.startswith("swd"):
|
||||
command = content.replace("swd","")
|
||||
newMessage = parseDestiny(message.author.display_name,command)
|
||||
messageList = newMessage.split("\n")
|
||||
for messageItem in messageList:
|
||||
await message.channel.send(messageItem)
|
||||
|
||||
# Rolls for critical injuries
|
||||
elif message.content.lower().startswith("!swcrit"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
command = message.content.lower().replace("!swcrit","").replace(" ","").replace("+","")
|
||||
elif content.startswith("swcrit"):
|
||||
command = content.replace("swcrit","").replace(" ","").replace("+","")
|
||||
|
||||
if command == "":
|
||||
command = 0
|
||||
|
||||
try:
|
||||
newMessage = funcs.critRoll(int(command))
|
||||
newMessage = critRoll(int(command))
|
||||
except:
|
||||
newMessage = "Try using a number, stupid"
|
||||
|
||||
@ -216,10 +193,9 @@ async def on_message(message):
|
||||
|
||||
# Accesses and changes character sheet data with the parseChar function
|
||||
# from funcs/swfuncs/swchar.py
|
||||
elif message.content.lower().startswith("!swchar") or message.content.lower().startswith("!sw"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
command = string.capwords(message.content.lower().replace("!swchar","").replace("!sw","").replace("+","+ ").replace("-","- ").replace(",",", "))
|
||||
title, desc = funcs.parseChar(message.author.display_name,command)
|
||||
elif content.startswith("swchar") or content.startswith("sw"):
|
||||
command = string.capwords(content.replace("swchar","").replace("sw","").replace("+","+ ").replace("-","- ").replace(",",", "))
|
||||
title, desc = parseChar(message.author.display_name,command)
|
||||
if title != "":
|
||||
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
|
||||
await message.channel.send(embed = em1)
|
||||
@ -228,13 +204,12 @@ async def on_message(message):
|
||||
|
||||
|
||||
# Searches for a specific page on the Senkulpa Wiki
|
||||
elif message.content.lower().startswith("!wiki "):
|
||||
elif content.startswith("wiki "):
|
||||
async with message.channel.typing():
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
command = string.capwords(message.content.lower().replace("!wiki ",""))
|
||||
title, content, thumbnail = funcs.findWikiPage(command)
|
||||
command = string.capwords(content.replace("wiki ",""))
|
||||
title, content, thumbnail = findWikiPage(command)
|
||||
if title != "":
|
||||
funcs.logThis("Sending the embedded message")
|
||||
logThis("Sending the embedded message")
|
||||
content += "\n[Læs mere](https://senkulpa.fandom.com/da/wiki/"+title.replace(" ","_")+")"
|
||||
embed = discord.Embed(title = title, description = content, colour=0xDEADBF)
|
||||
if thumbnail != "":
|
||||
@ -246,10 +221,9 @@ async def on_message(message):
|
||||
|
||||
|
||||
# Runs a trivia game
|
||||
elif message.content.lower().startswith("!trivia"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
if message.content.lower() == "!trivia" or message.content.lower() == "!trivia ":
|
||||
question, answers, correctAnswer = funcs.triviaStart(str(message.channel))
|
||||
elif content.startswith("trivia"):
|
||||
if content == "trivia" or content == "trivia ":
|
||||
question, answers, correctAnswer = triviaStart(str(message.channel))
|
||||
if answers != "":
|
||||
results = "**"+question+"**\n"
|
||||
for answer in range(len(answers)):
|
||||
@ -259,7 +233,7 @@ async def on_message(message):
|
||||
|
||||
await asyncio.sleep(60)
|
||||
|
||||
funcs.triviaCountPoints(str(message.channel))
|
||||
triviaCountPoints(str(message.channel))
|
||||
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -268,64 +242,65 @@ async def on_message(message):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
funcs.logThis("Time's up for the trivia question in "+str(message.channel))
|
||||
await message.channel.send("Time's up! The answer was \""+chr(correctAnswer)+") "+answers[correctAnswer-97]+"\". Anyone who answered that has gotten 1 GwendoBuck")
|
||||
logThis("Time's up for the trivia question in "+str(message.channel))
|
||||
await message.channel.send("Time's up The answer was \""+chr(correctAnswer)+") "+answers[correctAnswer-97]+"\". Anyone who answered that has gotten 1 GwendoBuck")
|
||||
else:
|
||||
await message.channel.send(question)
|
||||
|
||||
elif message.content.lower().startswith("!trivia "):
|
||||
command = message.content.lower().replace("!trivia ","")
|
||||
response = funcs.triviaOtherThing(message.author.display_name.lower(),str(message.channel),command)
|
||||
elif content.startswith("trivia "):
|
||||
command = content.replace("trivia ","")
|
||||
response = triviaAnswer(message.author.display_name.lower(),str(message.channel),command)
|
||||
if response.startswith("Locked in "):
|
||||
await message.add_reaction("👍")
|
||||
else:
|
||||
await message.channel.send(response)
|
||||
else:
|
||||
funcs.logThis("I didn't understand that")
|
||||
logThis("I didn't understand that")
|
||||
await message.channel.send("I didn't understand that")
|
||||
|
||||
|
||||
# Checks your GwendoBucks balance
|
||||
elif message.content.lower().startswith("!balance"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
response = funcs.checkBalance(message.author.display_name.lower())
|
||||
elif content.startswith("balance"):
|
||||
response = checkBalance(message.author.display_name.lower())
|
||||
if response == 1:
|
||||
new_message = message.author.display_name + " has " + str(response) + " GwendoBuck"
|
||||
else:
|
||||
new_message = message.author.display_name + " has " + str(response) + " GwendoBucks"
|
||||
await message.channel.send(new_message)
|
||||
|
||||
#gives money to other player
|
||||
elif message.content.lower().startswith("!give "):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
commands = message.content.lower().split(" ")
|
||||
# Gives money to other player
|
||||
elif content.startswith("give "):
|
||||
commands = content.split(" ")
|
||||
if len(commands) >= 3:
|
||||
try:
|
||||
amount = int(commands[2])
|
||||
response = funcs.giveMoney(message.author.display_name.lower(),commands[1],amount)
|
||||
response = giveMoney(message.author.display_name.lower(),commands[1],amount)
|
||||
await message.channel.send(response)
|
||||
except:
|
||||
funcs.logThis("I didn't quite understand that")
|
||||
logThis("I didn't quite understand that")
|
||||
await message.channel.send("I didn't quite understand that")
|
||||
else:
|
||||
funcs.logThis("I didn't understand that")
|
||||
logThis("I didn't understand that")
|
||||
await message.channel.send("I didn't understand that")
|
||||
|
||||
elif message.content.lower().startswith("!blackjack"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
if message.content.lower() == "!blackjack" or message.content.lower() == "!blackjack ":
|
||||
new_message = funcs.blackjackStart(str(message.channel))
|
||||
# Runs a game of Blackjack
|
||||
elif content.startswith("blackjack"):
|
||||
# Starts the game
|
||||
if content == "blackjack" or content == "blackjack ":
|
||||
new_message = blackjackStart(str(message.channel))
|
||||
if new_message == "started":
|
||||
cardsLeft = 0
|
||||
with open("resources/games/blackjackCards.txt","r") as f:
|
||||
for line in f:
|
||||
cardsLeft += 1
|
||||
|
||||
if cardsLeft < 50:
|
||||
funcs.shuffle()
|
||||
# Shuffles if not enough cards
|
||||
if cardsLeft < blackjackMinCards:
|
||||
blackjackShuffle(blackjackDecks)
|
||||
logThis("Shuffling the blackjack deck...")
|
||||
await message.channel.send("Shuffling the deck...")
|
||||
|
||||
new_message = "Blackjack game started. Use \"!blackjack bet [amount]\" to enter the game within the next 30 seconds."
|
||||
new_message = "Blackjack game started. Use \""+commandPrefix+"blackjack bet [amount]\" to enter the game within the next 30 seconds."
|
||||
await message.channel.send(new_message)
|
||||
old_image = await message.channel.send(file = discord.File("resources/games/blackjackTables/blackjackTable"+str(message.channel)+".png"))
|
||||
|
||||
@ -339,8 +314,9 @@ async def on_message(message):
|
||||
gamedone = True
|
||||
await message.channel.send("No one entered the game. Ending the game.")
|
||||
|
||||
# Loop of game rounds
|
||||
while gamedone == False:
|
||||
new_message, allStanding, gamedone = funcs.blackjackContinue(str(message.channel))
|
||||
new_message, allStanding, gamedone = blackjackContinue(str(message.channel))
|
||||
if new_message != "":
|
||||
await message.channel.send(new_message)
|
||||
if gamedone == False:
|
||||
@ -351,82 +327,109 @@ async def on_message(message):
|
||||
else:
|
||||
await asyncio.sleep(30)
|
||||
|
||||
new_message = funcs.blackjackFinish(str(message.channel))
|
||||
new_message = blackjackFinish(str(message.channel))
|
||||
await message.channel.send(new_message)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
await message.channel.send(new_message)
|
||||
elif message.content.lower().startswith("!blackjack bet"):
|
||||
commands = message.content.lower().split(" ")
|
||||
|
||||
# Entering game and placing bet
|
||||
elif content.startswith("blackjack bet"):
|
||||
commands = content.split(" ")
|
||||
try:
|
||||
amount = int(commands[2])
|
||||
except:
|
||||
funcs.logThis("I didn't understand that")
|
||||
logThis("I didn't understand that")
|
||||
response = "I didn't understand that"
|
||||
else:
|
||||
response = funcs.blackjackPlayerDrawHand(str(message.channel),message.author.display_name,amount)
|
||||
response = blackjackPlayerDrawHand(str(message.channel),message.author.display_name,amount)
|
||||
await message.channel.send(response)
|
||||
|
||||
elif message.content.lower().startswith("!blackjack hit"):
|
||||
if message.content.lower() == "!blackjack hit" or message.content.lower() == "!blackjack hit ":
|
||||
response = funcs.blackjackHit(str(message.channel),message.author.display_name)
|
||||
# Hitting
|
||||
elif content.startswith("blackjack hit"):
|
||||
if content == "blackjack hit" or content == "blackjack hit ":
|
||||
response = blackjackHit(str(message.channel),message.author.display_name)
|
||||
else:
|
||||
commands = message.content.lower().split(" ")
|
||||
commands = content.split(" ")
|
||||
try:
|
||||
handNumber = int(commands[2])
|
||||
except:
|
||||
handNumber = 0
|
||||
response = funcs.blackjackHit(str(message.channel),message.author.display_name,handNumber)
|
||||
response = blackjackHit(str(message.channel),message.author.display_name,handNumber)
|
||||
|
||||
if response == "accept":
|
||||
await message.add_reaction("👍")
|
||||
else:
|
||||
await message.channel.send(response)
|
||||
|
||||
|
||||
elif message.content.lower().startswith("!blackjack stand"):
|
||||
response = funcs.blackjackStand(str(message.channel),message.author.display_name,0)
|
||||
# Standing
|
||||
elif content.startswith("blackjack stand"):
|
||||
response = blackjackStand(str(message.channel),message.author.display_name,0)
|
||||
if response == "accept":
|
||||
await message.add_reaction("👍")
|
||||
else:
|
||||
await message.channel.send(response)
|
||||
|
||||
elif message.content.lower().startswith("!blackjack double"):
|
||||
if message.content.lower() == "!blackjack hit" or message.content.lower() == "!blackjack hit ":
|
||||
response = funcs.blackjackDouble(str(message.channel),message.author.display_name)
|
||||
# Doubling bet
|
||||
elif content.startswith("blackjack double"):
|
||||
if content == "blackjack hit" or content == "blackjack hit ":
|
||||
response = blackjackDouble(str(message.channel),message.author.display_name)
|
||||
else:
|
||||
commands = message.content.lower().split(" ")
|
||||
commands = content.split(" ")
|
||||
try:
|
||||
handNumber = int(commands[2])
|
||||
except:
|
||||
handNumber = 0
|
||||
response = funcs.blackjackDouble(str(message.channel),message.author.display_name,handNumber)
|
||||
response = blackjackDouble(str(message.channel),message.author.display_name,handNumber)
|
||||
|
||||
await message.channel.send(response)
|
||||
|
||||
elif message.content.lower().startswith("!blackjack split"):
|
||||
response = funcs.blackjackSplit(str(message.channel),message.author.display_name)
|
||||
# Splitting hand
|
||||
elif content.startswith("blackjack split"):
|
||||
response = blackjackSplit(str(message.channel),message.author.display_name)
|
||||
|
||||
await message.channel.send(response)
|
||||
|
||||
else:
|
||||
await message.channel.send("I didn't quite understand that")
|
||||
|
||||
elif message.content.lower().startswith("!fourinarow"):
|
||||
funcs.logThis(message.author.display_name+" ran \""+message.content+"\"")
|
||||
response, showImage = funcs.decipherCommand(message.content.lower().replace("!fourinarow",""),str(message.channel),message.author.display_name)
|
||||
# Runs a game of four in a row
|
||||
elif content.startswith("fourinarow"):
|
||||
response, showImage = parseFourInARow(content.replace("fourinarow",""),str(message.channel),message.author.display_name)
|
||||
await message.channel.send(response)
|
||||
funcs.logThis(response)
|
||||
logThis(response)
|
||||
if showImage:
|
||||
await message.channel.send(file = discord.File("resources/games/4InARowBoards/board"+str(message.channel)+".png"))
|
||||
|
||||
# Makes files if they don't exist yet
|
||||
makeFiles()
|
||||
|
||||
# Shuffling cards
|
||||
blackjackShuffle(4)
|
||||
|
||||
# Gets secret bot token
|
||||
with open("token.txt","r") as f:
|
||||
token = f.read().replace("\n","")
|
||||
|
||||
client = discord.Client()
|
||||
|
||||
# Logs in
|
||||
@client.event
|
||||
async def on_ready():
|
||||
logThis("Logged in as "+client.user.name+", "+str(client.user.id))
|
||||
game = discord.Game("Some weeb shit")
|
||||
await client.change_presence(activity=game)
|
||||
|
||||
# Reads messages and tests if they are Gwendolyn commands
|
||||
@client.event
|
||||
async def on_message(message):
|
||||
content = message.content
|
||||
if content.startswith(commandPrefix):
|
||||
logThis(message.author.display_name+" ran \""+content+"\"")
|
||||
await parseCommands(message,content.lower()[1:])
|
||||
|
||||
# Is a bit sassy sometimes
|
||||
meanWords = ["stupid", "bitch", "fuck", "dumb", "idiot"]
|
||||
if ("gwendolyn" in message.content.lower() or message.content.startswith("!")) 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():
|
||||
funcs.logThis(message.author.display_name+" was a bit mean")
|
||||
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():
|
||||
logThis(message.author.display_name+" was a bit mean")
|
||||
emoji = random.choice(["😠", "🖕", "👎"])
|
||||
await message.add_reaction(emoji)
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
from .gwendolynFuncs import helloFunc, cap, imageFunc, logThis, findWikiPage, makeFiles, replaceMultiple
|
||||
from .miscFuncs import helloFunc, cap, imageFunc, logThis, findWikiPage, makeFiles, replaceMultiple
|
||||
|
||||
from .swfuncs import parseChar, parseRoll, parseDestiny, critRoll
|
||||
from .swfuncs import *
|
||||
|
||||
from .lookup import spellFunc, monsterFunc
|
||||
from .lookup import *
|
||||
|
||||
from .other import nameGen, tavernGen, movieFunc
|
||||
from .other import *
|
||||
|
||||
from .games import triviaStart, triviaOtherThing, triviaCountPoints, checkBalance, addMoney, giveMoney, shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackStand, blackjackHit,blackjackDouble,blackjackSplit, decipherCommand
|
||||
from .games import *
|
||||
|
||||
from .roll import roll_dice
|
||||
from .roll import *
|
@ -1,4 +1,4 @@
|
||||
from .money import checkBalance, giveMoney, addMoney
|
||||
from .trivia import triviaCountPoints, triviaStart, triviaOtherThing
|
||||
from .blackjack import shuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble, blackjackSplit
|
||||
from .fourInARow import decipherCommand
|
||||
from .trivia import triviaCountPoints, triviaStart, triviaAnswer
|
||||
from .blackjack import blackjackShuffle, blackjackStart, blackjackPlayerDrawHand, blackjackContinue, blackjackFinish, blackjackHit, blackjackStand, blackjackDouble, blackjackSplit
|
||||
from .fourInARow import parseFourInARow
|
@ -7,15 +7,14 @@ from shutil import copyfile
|
||||
from funcs import logThis, replaceMultiple
|
||||
from . import money, blackjackDraw
|
||||
|
||||
deckAmount = 4
|
||||
|
||||
def shuffle():
|
||||
# Shuffles the blackjack cards
|
||||
def blackjackShuffle(decks):
|
||||
logThis("Shuffling the blackjack deck")
|
||||
|
||||
with open("resources/games/deckofCards.txt","r") as f:
|
||||
deck = f.read()
|
||||
|
||||
allDecks = deck.split("\n") * 4
|
||||
allDecks = deck.split("\n") * decks
|
||||
random.shuffle(allDecks)
|
||||
data = "\n".join(allDecks)
|
||||
|
||||
@ -24,6 +23,7 @@ def shuffle():
|
||||
|
||||
return
|
||||
|
||||
# Calculates the value of a blackjack hand
|
||||
def calcHandValue(hand : list):
|
||||
logThis("Calculating hand value")
|
||||
values = [0]
|
||||
@ -51,13 +51,13 @@ def calcHandValue(hand : list):
|
||||
|
||||
return handValue
|
||||
|
||||
# Draws a card from the deck
|
||||
def drawCard():
|
||||
logThis("drawing a card")
|
||||
with open("resources/games/blackjackCards.txt","r") as f:
|
||||
cards = f.read().split("\n")
|
||||
|
||||
drawnCard = cards[0]
|
||||
cards = cards[1:]
|
||||
drawnCard = cards.pop(0)
|
||||
data = "\n".join(cards)
|
||||
|
||||
with open("resources/games/blackjackCards.txt","w") as f:
|
||||
@ -65,6 +65,7 @@ def drawCard():
|
||||
|
||||
return drawnCard
|
||||
|
||||
# Dealer draws a card and checks if they should draw another one
|
||||
def dealerDraw(channel):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -85,6 +86,7 @@ def dealerDraw(channel):
|
||||
|
||||
return done
|
||||
|
||||
# Goes to the next round and calculates some stuff
|
||||
def blackjackContinue(channel):
|
||||
logThis("Continuing blackjack game")
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
@ -163,6 +165,7 @@ def blackjackContinue(channel):
|
||||
firstRoundMessage = ""
|
||||
return "You have 30 seconds to either hit or stand with \"!blackjack hit\" or \"!blackjack stand\""+firstRoundMessage+". It's assumed you're standing if you don't make a choice.", False, done
|
||||
|
||||
# When players try to hit
|
||||
def blackjackHit(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -216,6 +219,7 @@ def blackjackHit(channel,user,handNumber = 0):
|
||||
return "You can't hit before you see your cards"
|
||||
|
||||
|
||||
# When players try to double down
|
||||
def blackjackDouble(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -287,6 +291,7 @@ def blackjackDouble(channel,user,handNumber = 0):
|
||||
logThis(user+" tried to double on the 0th round")
|
||||
return "You can't double down before you see your cards"
|
||||
|
||||
# When players try to stand
|
||||
def blackjackStand(channel,user,handNumber = 0):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -310,6 +315,7 @@ def blackjackStand(channel,user,handNumber = 0):
|
||||
logThis(user+" tried to stand on the first round")
|
||||
return "You can't stand before you see your cards"
|
||||
|
||||
# When players try to split
|
||||
def blackjackSplit(channel,user):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -374,6 +380,7 @@ def blackjackSplit(channel,user):
|
||||
logThis(user+" tried to split on the 0th round")
|
||||
return "You can't split before you see your cards"
|
||||
|
||||
# Player enters the game and draws a hand
|
||||
def blackjackPlayerDrawHand(channel,user,bet):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -431,6 +438,7 @@ def blackjackPlayerDrawHand(channel,user,bet):
|
||||
logThis("There is no game going on in "+channel)
|
||||
return "There is no game going on in this channel"
|
||||
|
||||
# Starts a game of blackjack
|
||||
def blackjackStart(channel:str):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -456,6 +464,7 @@ def blackjackStart(channel:str):
|
||||
logThis("There is already a blackjack game going on in "+channel)
|
||||
return "There's already a blackjack game going on. Try again in a few minutes."
|
||||
|
||||
# Ends the game and calculates winnings
|
||||
def blackjackFinish(channel):
|
||||
finalWinnings = "*Final Winnings:*\n"
|
||||
|
||||
@ -480,6 +489,7 @@ def blackjackFinish(channel):
|
||||
winnings += 2 * data["blackjack games"][channel]["user hands"][user]["bet"]
|
||||
elif calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"]) > dealerValue:
|
||||
winnings += 2 * data["blackjack games"][channel]["user hands"][user]["bet"]
|
||||
reason = "(highest value)"
|
||||
elif calcHandValue(data["blackjack games"][channel]["user hands"][user]["hand"]) == dealerValue:
|
||||
reason = "(pushed)"
|
||||
winnings += data["blackjack games"][channel]["user hands"][user]["bet"]
|
||||
|
@ -4,6 +4,7 @@ import math
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
from funcs import logThis
|
||||
|
||||
# Draws the whole thing
|
||||
def drawImage(channel):
|
||||
logThis("Drawing four in a row board")
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
@ -29,13 +30,16 @@ def drawImage(channel):
|
||||
background = Image.new("RGBA", (w,h),backgroundColor)
|
||||
d = ImageDraw.Draw(background)
|
||||
|
||||
# This whole part was the easiest way to make a rectangle with rounded corners and an outline
|
||||
# - Corners:
|
||||
d.ellipse([(border,border),(border+cornerSize,border+cornerSize)],fill=boardColor,outline=(0,0,0),width=outlineSize)
|
||||
d.ellipse([(w-(border+cornerSize),h-(border+cornerSize)),(w-border,h-border)],fill=boardColor,outline=(0,0,0),width=outlineSize)
|
||||
d.ellipse([(border,h-(border+cornerSize)),(border+cornerSize,h-border)],fill=boardColor,outline=(0,0,0),width=outlineSize)
|
||||
d.ellipse([(w-(border+cornerSize),border),(w-border,border+cornerSize)],fill=boardColor,outline=(0,0,0),width=outlineSize)
|
||||
|
||||
# - Rectangle:
|
||||
d.rectangle([(border+math.floor(cornerSize/2),border),(w-(border+math.floor(cornerSize/2)),h-border)],fill=boardColor,outline=(0,0,0),width=outlineSize)
|
||||
d.rectangle([(border,border+math.floor(cornerSize/2)),(w-border,h-(border+math.floor(cornerSize/2)))],fill=boardColor,outline=(0,0,0),width=outlineSize)
|
||||
# - Removing outline on the inside:
|
||||
d.rectangle([(border+math.floor(cornerSize/2),border+math.floor(cornerSize/2)),(w-(border+math.floor(cornerSize/2)),h-(border+math.floor(cornerSize/2)))],fill=boardColor)
|
||||
d.ellipse([(border+outlineSize,border+outlineSize),(border+cornerSize-outlineSize,border+cornerSize-outlineSize)],fill=boardColor)
|
||||
d.ellipse([(w-(border+cornerSize)+outlineSize,h-(border+cornerSize)+outlineSize),(w-border-outlineSize,h-border-outlineSize)],fill=boardColor)
|
||||
|
@ -2,6 +2,7 @@ import json
|
||||
|
||||
from . import draw4InARow
|
||||
|
||||
# Starts the game
|
||||
def fourInARowStart(channel):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -21,7 +22,7 @@ def fourInARowStart(channel):
|
||||
else:
|
||||
return "There's already a 4 in a row game going on in this channel", False
|
||||
|
||||
|
||||
# Places a piece at the lowest available point in a specific column
|
||||
def placePiece(channel : str,player : int,column : int):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -51,8 +52,8 @@ def placePiece(channel : str,player : int,column : int):
|
||||
return "There's no game in this channel", False
|
||||
|
||||
|
||||
|
||||
def decipherCommand(command, channel, user):
|
||||
# Parses command
|
||||
def parseFourInARow(command, channel, user):
|
||||
if command == "" or command == " ":
|
||||
return fourInARowStart(channel)
|
||||
elif command.startswith(" place"):
|
||||
|
@ -2,6 +2,7 @@ import json
|
||||
|
||||
from funcs import logThis
|
||||
|
||||
# Returns the account balance for a user
|
||||
def checkBalance(user):
|
||||
user = user.lower()
|
||||
logThis("checking "+user+"'s account balance")
|
||||
@ -12,6 +13,7 @@ def checkBalance(user):
|
||||
return data["users"][user]
|
||||
else: return 0
|
||||
|
||||
# Adds money to the account of a user
|
||||
def addMoney(user,amount):
|
||||
user = user.lower()
|
||||
logThis("adding "+str(amount)+" to "+user+"'s account")
|
||||
@ -27,6 +29,7 @@ def addMoney(user,amount):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
# Transfers money from one user to another
|
||||
def giveMoney(user,targetUser,amount):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -35,7 +38,7 @@ def giveMoney(user,targetUser,amount):
|
||||
if data["users"][user] >= amount:
|
||||
addMoney(user,-1 * amount)
|
||||
addMoney(targetUser,amount)
|
||||
return "Transferred the GwendoBucks"
|
||||
return "Transferred "+str(amount)+" GwendoBucks to "+user
|
||||
else:
|
||||
logThis("They didn't have enough GwendoBucks")
|
||||
return "You don't have that many GwendoBucks"
|
||||
|
@ -5,6 +5,8 @@ import random
|
||||
from . import money
|
||||
from funcs import logThis
|
||||
|
||||
# Starts a game of trivia. Downloads a question with answers, shuffles the wrong answers with the
|
||||
# correct answer and returns the questions and answers. Also saves the question in the games.json file.
|
||||
def triviaStart(channel : str):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
triviaFile = json.load(f)
|
||||
@ -44,7 +46,8 @@ def triviaStart(channel : str):
|
||||
logThis("There was already a trivia question for that channel")
|
||||
return "There's already a trivia question going on. Try again in like, a minute", "", ""
|
||||
|
||||
def triviaOtherThing(user : str, channel : str, command : str):
|
||||
# Lets players answer a trivia question
|
||||
def triviaAnswer(user : str, channel : str, command : str):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
@ -66,6 +69,8 @@ def triviaOtherThing(user : str, channel : str, command : str):
|
||||
else:
|
||||
return "I didn't quite understand that"
|
||||
|
||||
|
||||
# Adds 1 GwendoBuck to each player that got the question right and deletes question from games.json.
|
||||
def triviaCountPoints(channel : str):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
@ -15,12 +15,11 @@ saves = ["strength_save","dexterity_save","constitution_save","intelligence_save
|
||||
abilities = ["acrobatics","animal_handling","arcana","athletics","deception","history","insight","intimidation","investigation","medicine","nature","perception","performance","persuasion","religion","sleight_of_hand","stealth","survival"]
|
||||
|
||||
# Looks up a monster
|
||||
def monsterFunc(content):
|
||||
command = cap(content.lower().replace("!monster ",""))
|
||||
def monsterFunc(command):
|
||||
logThis("Looking up "+command)
|
||||
|
||||
# 1-letter monsters don't exist
|
||||
if len(content.lower().split()) < 2:
|
||||
if len(command) < 2:
|
||||
logThis("Monster doesn't exist in database")
|
||||
return("I don't know that monster...","","","","","")
|
||||
else:
|
||||
@ -122,8 +121,7 @@ def monsterFunc(content):
|
||||
return("I don't know that monster...","","","","","")
|
||||
|
||||
# Looks up a spell
|
||||
def spellFunc(content):
|
||||
command = cap(content.lower().replace("!spell ",""))
|
||||
def spellFunc(command):
|
||||
logThis("Looking up "+command)
|
||||
|
||||
# Opens "spells.json"
|
||||
|
@ -183,10 +183,17 @@ def makeFiles():
|
||||
finally:
|
||||
f.close()
|
||||
|
||||
# Creates the blackjacktables foulder if it doesn't exist
|
||||
if os.path.isdir("resources/games/blackjackTables") == False:
|
||||
os.makedirs("resources/games/blackjackTables")
|
||||
logThis("The tables directory didn't exist")
|
||||
|
||||
# Creates the 4InARowBoards foulder if it doesn't exist
|
||||
if os.path.isdir("resources/games/4InARowBoards") == False:
|
||||
os.makedirs("resources/games/4InARowBoards")
|
||||
logThis("The tables directory didn't exist")
|
||||
|
||||
# Replaces multiple things with the same thing
|
||||
def replaceMultiple(mainString, toBeReplaces, newString):
|
||||
# Iterate over the strings to be replaced
|
||||
for elem in toBeReplaces :
|
@ -10,6 +10,7 @@ from funcs import logThis
|
||||
with open("resources/swskills.json", "r") as f:
|
||||
skillData = json.load(f)
|
||||
|
||||
# Rolls the specified dice
|
||||
def roll(abi : int = 1, prof : int = 0, dif : int = 3, cha : int = 0, boo : int = 0, setb : int = 0, force : int = 0):
|
||||
result = ""
|
||||
diceResult = []
|
||||
@ -50,6 +51,7 @@ def roll(abi : int = 1, prof : int = 0, dif : int = 3, cha : int = 0, boo : int
|
||||
|
||||
return result, diceResult
|
||||
|
||||
# Lets dice cancel each other out
|
||||
def simplify(result : str):
|
||||
logThis("Simplifying "+result)
|
||||
simp = ""
|
||||
@ -75,116 +77,119 @@ def simplify(result : str):
|
||||
|
||||
return simp
|
||||
|
||||
# Returns emoji that symbolize the dice results
|
||||
def diceResultToEmoji(diceResults : list):
|
||||
emoji = ""
|
||||
for result in diceResults:
|
||||
if result == "abiA":
|
||||
emoji += "<:abil1a:695267684476125264> "
|
||||
if result == "abiSA":
|
||||
elif result == "abiSA":
|
||||
emoji += "<:abil1a1s:695267684484513842> "
|
||||
if result == "abiS":
|
||||
elif result == "abiS":
|
||||
emoji += "<:abil1s:695267684514005013> "
|
||||
if result == "abiAA":
|
||||
elif result == "abiAA":
|
||||
emoji += "<:abil2a:695267684547428352> "
|
||||
if result == "abiSS":
|
||||
elif result == "abiSS":
|
||||
emoji += "<:abil2s:695267684761206914> "
|
||||
if result == "abi":
|
||||
elif result == "abi":
|
||||
emoji += "<:abilbla:695267684660674602> "
|
||||
|
||||
if result == "profA":
|
||||
elif result == "profA":
|
||||
emoji += "<:prof1a:695267685361123338> "
|
||||
if result == "profSA":
|
||||
elif result == "profSA":
|
||||
emoji += "<:prof1a1s:695267685067653140> "
|
||||
if result == "profR":
|
||||
elif result == "profR":
|
||||
emoji += "<:prof1r:695267685067522088> "
|
||||
if result == "profS":
|
||||
elif result == "profS":
|
||||
emoji += "<:prof1s:695267684899881012> "
|
||||
if result == "profAA":
|
||||
elif result == "profAA":
|
||||
emoji += "<:prof2a:695267684996218982> "
|
||||
if result == "profSS":
|
||||
elif result == "profSS":
|
||||
emoji += "<:prof2s:695267684878647327> "
|
||||
if result == "prof":
|
||||
elif result == "prof":
|
||||
emoji += "<:profbla:695267684698292235> "
|
||||
|
||||
if result == "difF":
|
||||
elif result == "difF":
|
||||
emoji += "<:dif1f:695267684924915804> "
|
||||
if result == "difH":
|
||||
elif result == "difH":
|
||||
emoji += "<:dif1h:695267684908138506> "
|
||||
if result == "difFH":
|
||||
elif result == "difFH":
|
||||
emoji += "<:dif1h1f:695267684908269678> "
|
||||
if result == "difFF":
|
||||
elif result == "difFF":
|
||||
emoji += "<:dif2f:695267684924784680> "
|
||||
if result == "difHH":
|
||||
elif result == "difHH":
|
||||
emoji += "<:dif2h:695267685071585340> "
|
||||
if result == "dif":
|
||||
elif result == "dif":
|
||||
emoji += "<:difbla:695267685000544276> "
|
||||
|
||||
if result == "chaD":
|
||||
elif result == "chaD":
|
||||
emoji += "<:cha1d:695267684962533447> "
|
||||
if result == "chaF":
|
||||
elif result == "chaF":
|
||||
emoji += "<:cha1f:695267684601954346> "
|
||||
if result == "chaH":
|
||||
elif result == "chaH":
|
||||
emoji += "<:cha1h:695267685046681620> "
|
||||
if result == "chaFH":
|
||||
elif result == "chaFH":
|
||||
emoji += "<:cha1h1f:695267685063327784> "
|
||||
if result == "chaFF":
|
||||
elif result == "chaFF":
|
||||
emoji += "<:cha2f:695267684832641097> "
|
||||
if result == "chaHH":
|
||||
elif result == "chaHH":
|
||||
emoji += "<:cha2h:695267684631183381> "
|
||||
if result == "cha":
|
||||
elif result == "cha":
|
||||
emoji += "<:chabla:695267684895686787> "
|
||||
|
||||
if result == "booA":
|
||||
elif result == "booA":
|
||||
emoji += "<:boo1a:695267684975116329> "
|
||||
if result == "booSA":
|
||||
elif result == "booSA":
|
||||
emoji += "<:boo1a1s:695267684970922024> "
|
||||
if result == "booS":
|
||||
elif result == "booS":
|
||||
emoji += "<:boo1s:695267684979441714> "
|
||||
if result == "booAA":
|
||||
elif result == "booAA":
|
||||
emoji += "<:boo2a:695267685100945488> "
|
||||
if result == "boo":
|
||||
elif result == "boo":
|
||||
emoji += "<:boobla:695267684757012550> "
|
||||
|
||||
if result == "setbF":
|
||||
elif result == "setbF":
|
||||
emoji += "<:set1f:695267685054939197> "
|
||||
if result == "setbH":
|
||||
elif result == "setbH":
|
||||
emoji += "<:set1h:695267685147082802> "
|
||||
if result == "setb":
|
||||
elif result == "setb":
|
||||
emoji += "<:setbla:695267685151408169> "
|
||||
|
||||
if result == "forceB":
|
||||
elif result == "forceB":
|
||||
emoji += "<:for1b:695267684593434677> "
|
||||
if result == "forceL":
|
||||
elif result == "forceL":
|
||||
emoji += "<:for1l:695267684606148640> "
|
||||
if result == "forceBB":
|
||||
elif result == "forceBB":
|
||||
emoji += "<:for2b:695267684903944303> "
|
||||
if result == "forceLL":
|
||||
elif result == "forceLL":
|
||||
emoji += "<:for2l:695267684992024626> "
|
||||
|
||||
return emoji
|
||||
|
||||
# Returns emoji that symbolize the results of the dice rolls
|
||||
def resultToEmoji(result : str):
|
||||
emoji = ""
|
||||
for char in result:
|
||||
if char == 'S':
|
||||
emoji += "<:success:690971244971163718> "
|
||||
if char == 'A':
|
||||
elif char == 'A':
|
||||
emoji += "<:advantage:690970761611051079> "
|
||||
if char == 'R':
|
||||
elif char == 'R':
|
||||
emoji += "<:swtriumph:690971267486187643> "
|
||||
if char == 'F':
|
||||
elif char == 'F':
|
||||
emoji += "<:failure:690970957786906664> "
|
||||
if char == 'H':
|
||||
elif char == 'H':
|
||||
emoji += "<:threat:690971009469382656> "
|
||||
if char == 'D':
|
||||
elif char == 'D':
|
||||
emoji += "<:despair:690971200163414238> "
|
||||
if char == 'L':
|
||||
elif char == 'L':
|
||||
emoji += "<:light:691010089905029171>"
|
||||
if char == 'B':
|
||||
elif char == 'B':
|
||||
emoji += "<:dark:691010101901000852>"
|
||||
|
||||
return emoji
|
||||
|
||||
# Converts emoji into letters
|
||||
def emojiToResult(emoji : str):
|
||||
result = ""
|
||||
for char in emoji:
|
||||
@ -195,6 +200,7 @@ def emojiToResult(emoji : str):
|
||||
|
||||
return result
|
||||
|
||||
# Returns emoji that symbolize the dice
|
||||
def diceToEmoji(dice : list):
|
||||
emoji = ""
|
||||
|
||||
@ -215,6 +221,7 @@ def diceToEmoji(dice : list):
|
||||
|
||||
return emoji
|
||||
|
||||
# Rolls for obligation
|
||||
def obligationRoll():
|
||||
logThis("Rolling for obligation")
|
||||
with open("resources/swcharacters.json", "r") as f:
|
||||
@ -232,6 +239,7 @@ def obligationRoll():
|
||||
|
||||
return random.choice(table)
|
||||
|
||||
# Rolls for critical injury
|
||||
def critRoll(addington : int):
|
||||
dd = "<:difficulty:690973992470708296>"
|
||||
sd = "<:setback:690972157890658415>"
|
||||
@ -283,6 +291,7 @@ def critRoll(addington : int):
|
||||
|
||||
return "Roll: "+str(roll)+"\nInjury:\n"+results
|
||||
|
||||
# Parses the command into something the other functions understand
|
||||
def parseRoll(user : str,cmd : str = ""):
|
||||
cmd = re.sub(' +',' ',cmd.upper()) + " "
|
||||
if cmd[0] == " ":
|
||||
|
@ -16,16 +16,16 @@
|
||||
|
||||
**!tavern** - Genererer en tilfældig tavern.
|
||||
|
||||
**!trivia** - Lader dig spille et spil trivia, hvor du kan tjene GwendoBucks.
|
||||
|
||||
**!balance** - Viser dig hvor mange GwendoBucks du har.
|
||||
|
||||
**!give** - Lader dig give GwendoBucks til andre.
|
||||
|
||||
**!swchar** - Lader dig lave en Star Wars karakter.
|
||||
|
||||
**!swroll** - Lader dig rulle Star Wars terninger.
|
||||
|
||||
**!balance** - Viser dig hvor mange GwendoBucks du har.
|
||||
|
||||
**!blackjack** - Lader dig spille it spil blackjack.
|
||||
|
||||
**!trivia** - Lader dig spille et spil trivia, hvor du kan tjene GwendoBucks.
|
||||
|
||||
Du kan få ekstra information om kommandoerne med "!help [kommando]".
|
||||
|
Reference in New Issue
Block a user