Even more converting to slash commands

This commit is contained in:
NikolajDanger
2021-03-29 17:01:01 +02:00
parent 232f97d0c8
commit e8c7fb95e5
22 changed files with 487 additions and 191 deletions

2
.gitignore vendored
View File

@ -158,7 +158,7 @@ resources/bedreNetflix/
resources/games/hilo/ resources/games/hilo/
resources/games/blackjackTables/ resources/games/blackjackTables/
resources/games/oldImages/ resources/games/oldImages/
resources/games/4InARowBoards/ resources/games/connect4Boards/
resources/games/hexBoards/ resources/games/hexBoards/
resources/games/hangmanBoards/ resources/games/hangmanBoards/
resources/lookup/monsters.json resources/lookup/monsters.json

View File

@ -1,9 +1,19 @@
import discord, asyncio import discord, asyncio, json
from discord.ext import commands from discord.ext import commands
from discord_slash import cog_ext from discord_slash import cog_ext
from discord_slash import SlashCommandOptionType as scot from discord_slash import SlashCommandOptionType as scot
from funcs import logThis from funcs import logThis
from utils import Options
with open("resources/slashParameters.json", "r") as f:
params = json.load(f)
options = Options()
if options.testing:
for p in params:
params[p]["guild_ids"] = options.guildIds
class GamesCog(commands.Cog): class GamesCog(commands.Cog):
@ -12,19 +22,19 @@ class GamesCog(commands.Cog):
self.bot = bot self.bot = bot
# Checks user balance # Checks user balance
@commands.command(aliases = ["b"]) @cog_ext.cog_slash(**params["balance"])
async def balance(self, ctx): async def balance(self, ctx):
response = self.bot.money.checkBalance("#"+str(ctx.message.author.id)) response = self.bot.money.checkBalance("#"+str(ctx.author.id))
if response == 1: if response == 1:
new_message = ctx.message.author.display_name + " has " + str(response) + " GwendoBuck" new_message = ctx.author.display_name + " has " + str(response) + " GwendoBuck"
else: else:
new_message = ctx.message.author.display_name + " has " + str(response) + " GwendoBucks" new_message = ctx.author.display_name + " has " + str(response) + " GwendoBucks"
await ctx.send(new_message) await ctx.send(new_message)
# Gives another user an amount of GwendoBucks # Gives another user an amount of GwendoBucks
@commands.command() @cog_ext.cog_slash(**params["give"])
async def give(self, ctx, *, content): async def give(self, ctx, parameters):
commands = content.split(" ") commands = parameters.split(" ")
amount = int(commands[-1]) amount = int(commands[-1])
username = " ".join(commands[:-1]) username = " ".join(commands[:-1])
if self.bot.funcs.getID(username) == None: if self.bot.funcs.getID(username) == None:
@ -33,13 +43,13 @@ class GamesCog(commands.Cog):
username = member.display_name username = member.display_name
userID = "#" + str(member.id) userID = "#" + str(member.id)
self.bot.database["users"].insert_one({"_id":userID,"user name":username,"money":0}) self.bot.database["users"].insert_one({"_id":userID,"user name":username,"money":0})
response = self.bot.money.giveMoney("#"+str(ctx.message.author.id),username,amount) response = self.bot.money.giveMoney("#"+str(ctx.author.id),username,amount)
await ctx.send(response) await ctx.send(response)
# Invest GwendoBucks in the stock market # Invest GwendoBucks in the stock market
@commands.command(aliases=["i"]) @cog_ext.cog_slash(**params["invest"])
async def invest(self, ctx, *, content = "check"): async def invest(self, ctx, parameters = "check"):
response = self.bot.invest.parseInvest(content,"#"+str(ctx.message.author.id)) response = self.bot.invest.parseInvest(parameters,"#"+str(ctx.author.id))
if response.startswith("**"): if response.startswith("**"):
responses = response.split("\n") responses = response.split("\n")
em = discord.Embed(title=responses[0],description="\n".join(responses[1:]),colour=0x00FF00) em = discord.Embed(title=responses[0],description="\n".join(responses[1:]),colour=0x00FF00)
@ -48,57 +58,102 @@ class GamesCog(commands.Cog):
await ctx.send(response) await ctx.send(response)
# Runs a game of trivia # Runs a game of trivia
@commands.command() @cog_ext.cog_slash(**params["trivia"])
async def trivia(self, ctx, *, content = ""): async def trivia(self, ctx, answer = ""):
if content == "": if answer == "":
question, answers, correctAnswer = self.bot.trivia.triviaStart(str(ctx.message.channel.id)) question, options, correctAnswer = self.bot.trivia.triviaStart(str(ctx.channel_id))
if answers != "": if options != "":
results = "**"+question+"**\n" results = "**"+question+"**\n"
for x, answer in enumerate(answers): for x, option in enumerate(options):
results += chr(x+97) + ") "+answer+"\n" results += chr(x+97) + ") "+option+"\n"
await ctx.send(results) await ctx.send(results)
await asyncio.sleep(60) await asyncio.sleep(60)
self.bot.trivia.triviaCountPoints(str(ctx.message.channel.id)) self.bot.trivia.triviaCountPoints(str(ctx.channel_id))
self.bot.funcs.deleteGame("trivia questions",str(ctx.message.channel.id)) self.bot.funcs.deleteGame("trivia questions",str(ctx.channel_id))
logThis("Time's up for the trivia question",str(ctx.message.channel.id)) logThis("Time's up for the trivia question",str(ctx.channel_id))
await ctx.send("Time's up The answer was \""+chr(correctAnswer)+") "+answers[correctAnswer-97]+"\". Anyone who answered that has gotten 1 GwendoBuck") await ctx.send("Time's up The answer was \""+chr(correctAnswer)+") "+options[correctAnswer-97]+"\". Anyone who answered that has gotten 1 GwendoBuck")
else: else:
await ctx.send(question) await ctx.send(question, hidden=True)
elif content in ["a","b","c","d"]: elif answer in ["a","b","c","d"]:
response = self.bot.trivia.triviaAnswer("#"+str(ctx.message.author.id),str(ctx.message.channel.id),content) response = self.bot.trivia.triviaAnswer("#"+str(ctx.author.id),str(ctx.channel_id),answer)
if response.startswith("Locked in "): if response.startswith("Locked in "):
await ctx.message.add_reaction("👍") await ctx.send(f"{ctx.author.display_name} answered {answer}")
else: else:
await ctx.send(response) await ctx.send(response)
else: else:
logThis("I didn't understand that (error code 1101)",str(ctx.message.channel.id)) logThis("I didn't understand that (error code 1101)",str(ctx.channel_id))
await ctx.send("I didn't understand that (error code 1101)") await ctx.send("I didn't understand that (error code 1101)")
# Runs a game of blackjack # Runs a game of blackjack
@commands.command(aliases = ["bj"]) @cog_ext.cog_slash(**params["blackjack"])
async def blackjack(self, ctx, *, content = ""): async def blackjack(self, ctx, parameters = ""):
await self.bot.blackjack.parseBlackjack(content,ctx) await self.bot.blackjack.parseBlackjack(parameters, ctx)
# Runs a game of Connect four # Start a game of connect four against a user
@commands.command(aliases = ["fiar","connect4","connectfour","4iar","4inarow"]) @cog_ext.cog_subcommand(**params["connectFourStartUser"])
async def fourinarow(self, ctx, *, content = ""): async def connectFourStartUser(self, ctx, user):
await self.bot.gameLoops.fiar(ctx.message.channel,content,"#"+str(ctx.message.author.id)) await self.bot.gameLoops.connectFour(ctx, "start "+user.display_name)
# Runs a game of Hangman # Start a game of connect four against gwendolyn
@commands.command(aliases = ["hm"]) @cog_ext.cog_subcommand(**params["connectFourStartGwendolyn"])
async def hangman(self, ctx, *, content = "start"): async def connectFourStartGwendolyn(self, ctx, difficulty = 3):
await self.bot.gameLoops.runHangman(ctx.message.channel,"#"+str(ctx.message.author.id),content) await self.bot.gameLoops.connectFour(ctx, "start "+str(difficulty))
# Runs a game of Hex # Stop the current game of connect four
@commands.command(name="hex") @cog_ext.cog_subcommand(**params["connectFourStop"])
async def hexCommand(self, ctx, *, content = ""): async def connectFourStop(self, ctx):
await self.bot.gameLoops.runHex(ctx.message.channel,content,"#"+str(ctx.message.author.id)) await self.bot.gameLoops.connectFour(ctx, "stop")
# Place a piece in the current game of connect four
@cog_ext.cog_subcommand(**params["connectFourPlace"])
async def connectFourPlace(self, ctx, column):
await self.bot.gameLoops.connectFour(ctx, "place "+str(column))
# Starts a game of Hangman
@cog_ext.cog_subcommand(**params["hangmanStart"])
async def hangmanStart(self, ctx):
await self.bot.gameLoops.runHangman(ctx.channel,"#"+str(ctx.author.id),"start", ctx)
# Stops a game of Hangman
@cog_ext.cog_subcommand(**params["hangmanStop"])
async def hangmanStop(self, ctx):
await self.bot.gameLoops.runHangman(ctx.channel,"#"+str(ctx.author.id),"stop", ctx)
# Start a game of Hex against another user
@cog_ext.cog_subcommand(**params["hexStartUser"])
async def hexStartUser(self, ctx, user):
await self.bot.gameLoops.runHex(ctx, "start "+user.display_name, "#"+str(ctx.author.id))
# Start a game of Hex against Gwendolyn
@cog_ext.cog_subcommand(**params["hexStartGwendolyn"])
async def hexStartGwendolyn(self, ctx, difficulty = 2):
await self.bot.gameLoops.runHex(ctx, "start "+str(difficulty), "#"+str(ctx.author.id))
# Undo your last hex move
@cog_ext.cog_subcommand(**params["hexUndo"])
async def hexUndo(self, ctx):
await self.bot.gameLoops.runHex(ctx, "undo", "#"+str(ctx.author.id))
# Perform a hex swap
@cog_ext.cog_subcommand(**params["hexSwap"])
async def hexSwap(self, ctx):
await self.bot.gameLoops.runHex(ctx, "swap", "#"+str(ctx.author.id))
# Surrender the hex game
@cog_ext.cog_subcommand(**params["hexSurrender"])
async def hexSurrender(self, ctx):
await self.bot.gameLoops.runHex(ctx, "surrender", "#"+str(ctx.author.id))
# Place a piece in the hex game
@cog_ext.cog_subcommand(**params["hexPlace"])
async def hexPlace(self, ctx, coordinates):
await self.bot.gameLoops.runHex(ctx, "place "+coordinates, "#"+str(ctx.author.id))
def setup(bot): def setup(bot):
bot.add_cog(GamesCog(bot)) bot.add_cog(GamesCog(bot))

View File

@ -14,15 +14,15 @@ class ReactionCog(commands.Cog):
channel = message.channel channel = message.channel
logThis(user.display_name+" reacted to a message",str(channel.id)) logThis(user.display_name+" reacted to a message",str(channel.id))
try: try:
fourInARowTheirTurn, piece = self.client.funcs.fiarReactionTest(channel,message,"#"+str(user.id)) connectFourTheirTurn, piece = self.client.funcs.connectFourReactionTest(channel,message,"#"+str(user.id))
except: except:
fourInARowTheirTurn = False connectFourTheirTurn = False
bedreNetflixMessage, addMovie, imdbIds = self.client.funcs.bedreNetflixReactionTest(channel,message) bedreNetflixMessage, addMovie, imdbIds = self.client.funcs.bedreNetflixReactionTest(channel,message)
if fourInARowTheirTurn: if connectFourTheirTurn:
place = emojiToCommand(reaction.emoji) place = emojiToCommand(reaction.emoji)
await self.client.gameLoops.fiar(channel," place "+str(piece)+" "+str(place),user.id) await self.client.gameLoops.connectFour(message,"place "+str(piece)+" "+str(place),user.id, str(message.channel.id))
elif bedreNetflixMessage and addMovie: elif bedreNetflixMessage and addMovie:
moviePick = emojiToCommand(reaction.emoji) moviePick = emojiToCommand(reaction.emoji)
await message.delete() await message.delete()

View File

@ -1,8 +1,18 @@
import discord, string import discord, string, json
from discord.ext import commands from discord.ext import commands
from discord_slash import cog_ext from discord_slash import cog_ext
from funcs import cap from funcs import cap
from utils import Options
with open("resources/slashParameters.json", "r") as f:
params = json.load(f)
options = Options()
if options.testing:
for p in params:
params[p]["guild_ids"] = options.guildIds
class SwCog(commands.Cog): class SwCog(commands.Cog):
@ -11,37 +21,43 @@ class SwCog(commands.Cog):
self.client = client self.client = client
# Rolls star wars dice # Rolls star wars dice
@cog_ext.cog_slash() @cog_ext.cog_slash(**params["starWarsRoll"])
async def swroll(self, ctx, dice = ""): async def starWarsRoll(self, ctx, dice = ""):
command = cap(dice) command = cap(dice)
newMessage = self.client.swroll.parseRoll("#"+str(ctx.message.author.id),command) newMessage = self.client.swroll.parseRoll("#"+str(ctx.author.id),command)
messageList = newMessage.split("\n") messageList = newMessage.split("\n")
for messageItem in messageList: await ctx.send(messageList[0])
await ctx.send(messageItem) if len(messageList) > 1:
for messageItem in messageList[1:]:
await ctx.channel.send(messageItem)
# Controls destiny points # Controls destiny points
@cog_ext.cog_slash() @cog_ext.cog_slash(**params["starWarsDestiny"])
async def swd(self, ctx, *, content): async def starWarsDestiny(self, ctx, parameters = ""):
newMessage = self.client.swdestiny.parseDestiny("#"+str(ctx.message.author.id),content) newMessage = self.client.swdestiny.parseDestiny("#"+str(ctx.author.id),parameters)
messageList = newMessage.split("\n") messageList = newMessage.split("\n")
for messageItem in messageList: await ctx.send(messageList[0])
await ctx.send(messageItem) if len(messageList) > 1:
for messageItem in messageList[1:]:
await ctx.channel.send(messageItem)
# Rolls for critical injuries # Rolls for critical injuries
@cog_ext.cog_slash() @cog_ext.cog_slash(**params["starWarsCrit"])
async def swcrit(self, ctx, arg : int = 0): async def starWarsCrit(self, ctx, severity : int = 0):
newMessage = self.client.swroll.critRoll(int(arg)) newMessage = self.client.swroll.critRoll(int(severity))
messageList = newMessage.split("\n") messageList = newMessage.split("\n")
for messageItem in messageList: await ctx.send(messageList[0])
await ctx.send(messageItem) if len(messageList) > 1:
for messageItem in messageList[1:]:
await ctx.channel.send(messageItem)
# Accesses and changes character sheet data with the parseChar function # Accesses and changes character sheet data with the parseChar function
# from funcs/swfuncs/swchar.py # from funcs/swfuncs/swchar.py
@cog_ext.cog_slash() @cog_ext.cog_slash(**params["starWarsCharacter"])
async def swchar(self, ctx, *, content = ""): async def starWarsCharacter(self, ctx, parameters = ""):
command = string.capwords(content.replace("+","+ ").replace("-","- ").replace(",",", ")) command = string.capwords(parameters.replace("+","+ ").replace("-","- ").replace(",",", "))
title, desc = self.client.swchar.parseChar("#"+str(ctx.message.author.id),command) title, desc = self.client.swchar.parseChar("#"+str(ctx.author.id),command)
if title != "": if title != "":
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF) em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
await ctx.send(embed = em1) await ctx.send(embed = em1)

View File

@ -32,19 +32,21 @@ class Funcs():
def stopServer(self): def stopServer(self):
self.bot.database["trivia questions"].delete_many({}) self.bot.database["trivia questions"].delete_many({})
self.bot.database["blackjack games"].delete_many({}) self.bot.database["blackjack games"].delete_many({})
self.bot.database["connect 4 games"].delete_many({})
self.bot.database["hangman games"].delete_many({})
if not self.bot.options.testing: if not self.bot.options.testing:
g = git.cmd.Git("") g = git.cmd.Git("")
g.pull() g.pull()
def fiarReactionTest(self,channel,message,user): def connectFourReactionTest(self,channel,message,user):
game = self.bot.database["4 in a row games"].find_one({"_id":str(channel.id)}) game = self.bot.database["connect 4 games"].find_one({"_id":str(channel.id)})
with open("resources/games/oldImages/fourInARow"+str(channel.id), "r") as f: with open("resources/games/oldImages/connectFour"+str(channel.id), "r") as f:
oldImage = int(f.read()) oldImage = int(f.read())
if message.id == oldImage: if message.id == oldImage:
logThis("They reacted to the fourinarow game") logThis("They reacted to the connectFour game")
turn = game["turn"] turn = game["turn"]
if user == game["players"][turn]: if user == game["players"][turn]:
return True, turn+1 return True, turn+1

View File

@ -481,8 +481,8 @@ class Blackjack():
self.bot.database["blackjack games"].update_one({"_id":channel}, self.bot.database["blackjack games"].update_one({"_id":channel},
{"$set":{"user hands."+user:newHand}}) {"$set":{"user hands."+user:newHand}})
logThis(self.bot.funcs.getName(user)+" entered the game") logThis(f"{self.bot.funcs.getName(user)} entered the game with a bet of {bet}")
return self.bot.funcs.getName(user)+" entered the game" return f"{self.bot.funcs.getName(user)} entered the game with a bet of {bet}"
else: else:
logThis(user+" doesn't have enough GwendoBucks") logThis(user+" doesn't have enough GwendoBucks")
return "You don't have enough GwendoBucks to place that bet" return "You don't have enough GwendoBucks to place that bet"
@ -711,9 +711,10 @@ class Blackjack():
blackjackMinCards = 50 blackjackMinCards = 50
blackjackDecks = 4 blackjackDecks = 4
channel = ctx.message.channel.id channel = ctx.channel_id
# Starts the game # Starts the game
if content == "": if content == "":
await ctx.send("Staring a new game of blackjack")
cardsLeft = 0 cardsLeft = 0
cards = self.bot.database["blackjack cards"].find_one({"_id":str(channel)}) cards = self.bot.database["blackjack cards"].find_one({"_id":str(channel)})
if cards != None: if cards != None:
@ -723,14 +724,14 @@ class Blackjack():
if cardsLeft < blackjackMinCards: if cardsLeft < blackjackMinCards:
self.blackjackShuffle(blackjackDecks,str(channel)) self.blackjackShuffle(blackjackDecks,str(channel))
logThis("Shuffling the blackjack deck...",str(channel)) logThis("Shuffling the blackjack deck...",str(channel))
await ctx.send("Shuffling the deck...") await ctx.channel.send("Shuffling the deck...")
new_message = self.blackjackStart(str(channel)) new_message = self.blackjackStart(str(channel))
if new_message == "started": if new_message == "started":
new_message = "Blackjack game started. Use \"!blackjack bet [amount]\" to enter the game within the next 30 seconds." new_message = "Blackjack game started. Use \"!blackjack bet [amount]\" to enter the game within the next 30 seconds."
await ctx.send(new_message) await ctx.channel.send(new_message)
oldImage = await ctx.send(file = discord.File("resources/games/blackjackTables/blackjackTable"+str(channel)+".png")) oldImage = await ctx.channel.send(file = discord.File("resources/games/blackjackTables/blackjackTable"+str(channel)+".png"))
with open("resources/games/oldImages/blackjack"+str(channel), "w") as f: with open("resources/games/oldImages/blackjack"+str(channel), "w") as f:
f.write(str(oldImage.id)) f.write(str(oldImage.id))
@ -743,45 +744,45 @@ class Blackjack():
if len(game["user hands"]) == 0: if len(game["user hands"]) == 0:
gamedone = True gamedone = True
await ctx.send("No one entered the game. Ending the game.") await ctx.channel.send("No one entered the game. Ending the game.")
gameID = game["gameID"] gameID = game["gameID"]
# Loop of game rounds # Loop of game rounds
if gamedone == False: if gamedone == False:
logThis("!blackjack calling self.blackjackLoop()",str(channel)) logThis("!blackjack calling self.blackjackLoop()",str(channel))
await self.blackjackLoop(ctx.message.channel,1,gameID) await self.blackjackLoop(ctx.channel,1,gameID)
else: else:
new_message = self.blackjackFinish(str(channel)) new_message = self.blackjackFinish(str(channel))
await ctx.send(new_message) await ctx.channel.send(new_message)
else: else:
await ctx.send(new_message) await ctx.channel.send(new_message)
# Entering game and placing bet # Entering game and placing bet
elif content.startswith("bet"): elif content.startswith("bet"):
commands = content.split(" ") commands = content.split(" ")
amount = int(commands[1]) amount = int(commands[1])
response = self.blackjackPlayerDrawHand(str(channel),"#"+str(ctx.message.author.id),amount) response = self.blackjackPlayerDrawHand(str(channel),"#"+str(ctx.author.id),amount)
await ctx.send(response) await ctx.send(response)
# Hitting # Hitting
elif content.startswith("hit"): elif content.startswith("hit"):
if content == "hit": if content == "hit":
response = self.blackjackHit(str(channel),"#"+str(ctx.message.author.id)) response = self.blackjackHit(str(channel),"#"+str(ctx.author.id))
else: else:
commands = content.split(" ") commands = content.split(" ")
try: try:
handNumber = int(commands[1]) handNumber = int(commands[1])
except: except:
handNumber = 0 handNumber = 0
response = self.blackjackHit(str(channel),"#"+str(ctx.message.author.id),handNumber) response = self.blackjackHit(str(channel),"#"+str(ctx.author.id),handNumber)
if response.startswith("accept"): if response.startswith("accept"):
await ctx.message.add_reaction("👍") await ctx.send(f"{ctx.author.display_name} hit")
#try: #try:
if response[6] == "T": if response[6] == "T":
gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"] gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"]
logThis("Hit calling self.blackjackLoop()",str(channel)) logThis("Hit calling self.blackjackLoop()",str(channel))
await self.blackjackLoop(ctx.message.channel,int(response[7:])+1,gameID) await self.blackjackLoop(ctx.channel,int(response[7:])+1,gameID)
#except: #except:
# logThis("Something fucked up (error code 1320)",str(channel)) # logThis("Something fucked up (error code 1320)",str(channel))
else: else:
@ -791,22 +792,22 @@ class Blackjack():
# Standing # Standing
elif content.startswith("stand"): elif content.startswith("stand"):
if content == "hit": if content == "hit":
response = self.blackjackStand(str(channel),"#"+str(ctx.message.author.id)) response = self.blackjackStand(str(channel),"#"+str(ctx.author.id))
else: else:
commands = content.split(" ") commands = content.split(" ")
try: try:
handNumber = int(commands[1]) handNumber = int(commands[1])
except: except:
handNumber = 0 handNumber = 0
response = self.blackjackStand(str(channel),"#"+str(ctx.message.author.id),handNumber) response = self.blackjackStand(str(channel),"#"+str(ctx.author.id),handNumber)
if response.startswith("accept"): if response.startswith("accept"):
await ctx.message.add_reaction("👍") await ctx.send(f"{ctx.author.display_name} is standing")
#try: #try:
if response[6] == "T": if response[6] == "T":
gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"] gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"]
logThis("Stand calling self.blackjackLoop()",str(channel)) logThis("Stand calling self.blackjackLoop()",str(channel))
await self.blackjackLoop(ctx.message.channel,int(response[7:])+1,gameID) await self.blackjackLoop(ctx.channel,int(response[7:])+1,gameID)
#except: #except:
# logThis("Something fucked up (error code 1320)",str(channel)) # logThis("Something fucked up (error code 1320)",str(channel))
else: else:
@ -819,7 +820,7 @@ class Blackjack():
handNumber = int(commands[1]) handNumber = int(commands[1])
except: except:
handNumber = 0 handNumber = 0
response, roundDone = self.blackjackDouble(str(channel),"#"+str(ctx.message.author.id),handNumber) response, roundDone = self.blackjackDouble(str(channel),"#"+str(ctx.author.id),handNumber)
await ctx.send(response) await ctx.send(response)
@ -827,7 +828,7 @@ class Blackjack():
if roundDone[0] == "T": if roundDone[0] == "T":
gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"] gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"]
logThis("Double calling self.blackjackLoop()",str(channel)) logThis("Double calling self.blackjackLoop()",str(channel))
await self.blackjackLoop(ctx.message.channel,int(roundDone[1:])+1,gameID) await self.blackjackLoop(ctx.channel,int(roundDone[1:])+1,gameID)
except: except:
logThis("Something fucked up (error code 1320)",str(channel)) logThis("Something fucked up (error code 1320)",str(channel))
@ -838,7 +839,7 @@ class Blackjack():
handNumber = int(commands[1]) handNumber = int(commands[1])
except: except:
handNumber = 0 handNumber = 0
response, roundDone = self.blackjackSplit(str(channel),"#"+str(ctx.message.author.id),handNumber) response, roundDone = self.blackjackSplit(str(channel),"#"+str(ctx.author.id),handNumber)
await ctx.send(response) await ctx.send(response)
@ -846,7 +847,7 @@ class Blackjack():
if roundDone[0] == "T": if roundDone[0] == "T":
gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"] gameID = self.bot.database["blackjack games"].find_one({"_id":str(channel)})["gameID"]
logThis("Split calling self.blackjackLoop()",str(channel)) logThis("Split calling self.blackjackLoop()",str(channel))
await self.blackjackLoop(ctx.message.channel,int(roundDone[1:])+1,gameID) await self.blackjackLoop(ctx.channel,int(roundDone[1:])+1,gameID)
except: except:
logThis("Something fucked up (error code 1320)") logThis("Something fucked up (error code 1320)")
@ -857,7 +858,7 @@ class Blackjack():
hilo = str(data["hilo"]) hilo = str(data["hilo"])
else: else:
hilo = "0" hilo = "0"
await ctx.send(hilo) await ctx.send(hilo, hidden=True)
# Shuffles the blackjack deck # Shuffles the blackjack deck
elif content.startswith("shuffle"): elif content.startswith("shuffle"):
@ -874,7 +875,7 @@ class Blackjack():
cardsLeft = len(cards["cards"]) cardsLeft = len(cards["cards"])
decksLeft = round(cardsLeft/52,1) decksLeft = round(cardsLeft/52,1)
await ctx.send(str(cardsLeft)+" cards, "+str(decksLeft)+" decks") await ctx.send(str(cardsLeft)+" cards, "+str(decksLeft)+" decks", hidden=True)
else: else:
logThis("Not a command (error code 1301)") logThis("Not a command (error code 1301)")

View File

@ -2,7 +2,7 @@ import random
import copy import copy
import math import math
from .fourInARowDraw import DrawFourInARow from .connectFourDraw import drawConnectFour
from funcs import logThis from funcs import logThis
AIScores = { AIScores = {
@ -20,14 +20,14 @@ rowCount = 6
columnCount = 7 columnCount = 7
easy = True easy = True
class FourInARow(): class connectFour():
def __init__(self,bot): def __init__(self,bot):
self.bot = bot self.bot = bot
self.draw = DrawFourInARow(bot) self.draw = drawConnectFour(bot)
# Starts the game # Starts the game
def fourInARowStart(self, channel, user, opponent): def connectFourStart(self, channel, user, opponent):
game = self.bot.database["4 in a row games"].find_one({"_id":channel}) game = self.bot.database["connect 4 games"].find_one({"_id":channel})
if game == None: if game == None:
@ -62,7 +62,7 @@ class FourInARow():
newGame = {"_id":channel,"board": board,"winner":0,"win direction":"", newGame = {"_id":channel,"board": board,"winner":0,"win direction":"",
"win coordinates":[0,0],"players":players,"turn":0,"difficulty":difficulty} "win coordinates":[0,0],"players":players,"turn":0,"difficulty":difficulty}
self.bot.database["4 in a row games"].insert_one(newGame) self.bot.database["connect 4 games"].insert_one(newGame)
self.draw.drawImage(channel) self.draw.drawImage(channel)
@ -73,11 +73,11 @@ class FourInARow():
return "Started game against "+self.bot.funcs.getName(opponent)+diffText+". It's "+self.bot.funcs.getName(players[0])+"'s turn", True, False, False, gwendoTurn return "Started game against "+self.bot.funcs.getName(opponent)+diffText+". It's "+self.bot.funcs.getName(players[0])+"'s turn", True, False, False, gwendoTurn
else: else:
return "There's already a 4 in a row game going on in this channel", False, False, False, False return "There's already a connect 4 game going on in this channel", False, False, False, False
# Places a piece at the lowest available point in a specific column # Places a piece at the lowest available point in a specific column
def placePiece(self, channel : str,player : int,column : int): def placePiece(self, channel : str,player : int,column : int):
game = self.bot.database["4 in a row games"].find_one({"_id":channel}) game = self.bot.database["connect 4 games"].find_one({"_id":channel})
if game != None: if game != None:
board = game["board"] board = game["board"]
@ -85,18 +85,18 @@ class FourInARow():
board = self.placeOnBoard(board,player,column) board = self.placeOnBoard(board,player,column)
if board != None: if board != None:
self.bot.database["4 in a row games"].update_one({"_id":channel},{"$set":{"board":board}}) self.bot.database["connect 4 games"].update_one({"_id":channel},{"$set":{"board":board}})
turn = (game["turn"]+1)%2 turn = (game["turn"]+1)%2
self.bot.database["4 in a row games"].update_one({"_id":channel},{"$set":{"turn":turn}}) self.bot.database["connect 4 games"].update_one({"_id":channel},{"$set":{"turn":turn}})
logThis("Checking for win") logThis("Checking for win")
won, winDirection, winCoordinates = self.isWon(board) won, winDirection, winCoordinates = self.isWon(board)
if won != 0: if won != 0:
gameWon = True gameWon = True
self.bot.database["4 in a row games"].update_one({"_id":channel},{"$set":{"winner":won}}) self.bot.database["connect 4 games"].update_one({"_id":channel},{"$set":{"winner":won}})
self.bot.database["4 in a row games"].update_one({"_id":channel},{"$set":{"win direction":winDirection}}) self.bot.database["connect 4 games"].update_one({"_id":channel},{"$set":{"win direction":winDirection}})
self.bot.database["4 in a row games"].update_one({"_id":channel}, self.bot.database["connect 4 games"].update_one({"_id":channel},
{"$set":{"win coordinates":winCoordinates}}) {"$set":{"win coordinates":winCoordinates}})
message = self.bot.funcs.getName(game["players"][won-1])+" placed a piece in column "+str(column+1)+" and won." message = self.bot.funcs.getName(game["players"][won-1])+" placed a piece in column "+str(column+1)+" and won."
@ -139,19 +139,19 @@ class FourInARow():
return board return board
# Parses command # Parses command
def parseFourInARow(self, command, channel, user): def parseconnectFour(self, command, channel, user):
commands = command.split() commands = command.split()
if command == "" or command == " ": if command == "" or command == " ":
return "I didn't get that. Use \"!fourinarow start [opponent]\" to start a game. To play against the computer, use difficulty 1 through 5 as the [opponent].", False, False, False, False return "I didn't get that. Use \"!connectFour start [opponent]\" to start a game. To play against the computer, use difficulty 1 through 5 as the [opponent].", False, False, False, False
elif commands[0] == "start": elif commands[0] == "start":
# Starting a game # Starting a game
if len(commands) == 1: # if the commands is "!fourinarow start", the opponent is Gwendolyn if len(commands) == 1: # if the commands is "!connectFour start", the opponent is Gwendolyn
commands.append("3") commands.append("3")
return self.fourInARowStart(channel,user,commands[1]) # commands[1] is the opponent return self.connectFourStart(channel,user,commands[1]) # commands[1] is the opponent
# Stopping the game # Stopping the game
elif commands[0] == "stop": elif commands[0] == "stop":
game = self.bot.database["4 in a row games"].find_one({"_id":channel}) game = self.bot.database["connect 4 games"].find_one({"_id":channel})
if user in game["players"]: if user in game["players"]:
return "Ending game.", False, False, True, False return "Ending game.", False, False, True, False
@ -160,12 +160,21 @@ class FourInARow():
# Placing manually # Placing manually
elif commands[0] == "place": elif commands[0] == "place":
try: if len(commands) == 2:
return self.placePiece(channel,int(commands[1]),int(commands[2])-1) game = self.bot.database["connect 4 games"].find_one({"_id":channel})
except: turn = game["turn"]
return "I didn't get that. To place a piece use \"!fourinarow place [player number] [column]\" or press the corresponding message-reaction beneath the board.", False, False, False, False if user == game["players"][turn]:
piece = turn + 1
else: else:
return "I didn't get that. Use \"!fourinarow start [opponent]\" to start a game. To play against the computer, use difficulty 1 through 5 as the [opponent].", False, False, False, False logThis("It wasn't their turn")
return "It's not your turn!", False, False, False, False
column = int(commands[1])-1
else:
column = int(commands[2])-1
piece = int(commands[1])
return self.placePiece(channel, piece, column)
else:
return "I didn't get that. Use \"!connectFour start [opponent]\" to start a game. To play against the computer, use difficulty 1 through 5 as the [opponent].", False, False, False, False
# Checks if someone has won the game and returns the winner # Checks if someone has won the game and returns the winner
def isWon(self, board): def isWon(self, board):
@ -226,9 +235,9 @@ class FourInARow():
return won, winDirection, winCoordinates return won, winDirection, winCoordinates
# Plays as the AI # Plays as the AI
async def fourInARowAI(self, channel): async def connectFourAI(self, channel):
logThis("Figuring out best move") logThis("Figuring out best move")
game = self.bot.database["4 in a row games"].find_one({"_id":channel}) game = self.bot.database["connect 4 games"].find_one({"_id":channel})
board = game["board"] board = game["board"]
player = game["players"].index("Gwendolyn")+1 player = game["players"].index("Gwendolyn")+1

View File

@ -3,14 +3,14 @@ import math
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
from funcs import logThis from funcs import logThis
class DrawFourInARow(): class drawConnectFour():
def __init__(self,bot): def __init__(self,bot):
self.bot = bot self.bot = bot
# Draws the whole thing # Draws the whole thing
def drawImage(self, channel): def drawImage(self, channel):
logThis("Drawing four in a row board") logThis("Drawing connect four board")
game = self.bot.database["4 in a row games"].find_one({"_id":channel}) game = self.bot.database["connect 4 games"].find_one({"_id":channel})
board = game["board"] board = game["board"]
@ -153,4 +153,4 @@ class DrawFourInARow():
d.text((w-border-textWidth,exampleHeight),player2,font=fnt,fill=(0,0,0)) d.text((w-border-textWidth,exampleHeight),player2,font=fnt,fill=(0,0,0))
background.save("resources/games/4InARowBoards/board"+channel+".png") background.save("resources/games/connect4Boards/board"+channel+".png")

View File

@ -23,36 +23,36 @@ class GameLoops():
return oldMessage return oldMessage
# Runs Four in a Row # Runs connect four
async def fiar(self, channel,command,user): async def connectFour(self, ctx, command, user = None, channelId = None):
try: if user is None:
response, showImage, deleteImage, gameDone, gwendoTurn = self.bot.fourInARow.parseFourInARow(command,str(channel.id),user) user = "#"+str(ctx.author.id)
except:
logThis("Error parsing command (error code 1410)")
await channel.send(response) if channelId is None:
logThis(response,str(channel.id)) channelId = str(ctx.channel_id)
response, showImage, deleteImage, gameDone, gwendoTurn = self.bot.connectFour.parseconnectFour(command,channelId, user)
if hasattr(ctx, "send"):
await ctx.send(response)
else:
await ctx.channel.send(response)
logThis(response,channelId)
if showImage: if showImage:
if deleteImage: if deleteImage:
try: oldImage = await self.deleteMessage("connectFour"+channelId,ctx.channel)
oldImage = await self.deleteMessage("fourInARow"+str(channel.id),channel) oldImage = await ctx.channel.send(file = discord.File("resources/games/connect4Boards/board"+channelId+".png"))
except:
logThis("Error deleting message (error code 1401)")
oldImage = await channel.send(file = discord.File("resources/games/4InARowBoards/board"+str(channel.id)+".png"))
if gameDone == False: if gameDone == False:
if gwendoTurn: if gwendoTurn:
try: response, showImage, deleteImage, gameDone, gwendoTurn = await self.bot.connectFour.connectFourAI(channelId)
response, showImage, deleteImage, gameDone, gwendoTurn = await self.bot.fourInARow.fourInARowAI(str(channel.id)) await ctx.channel.send(response)
except: logThis(response,channelId)
logThis("AI error (error code 1420)")
await channel.send(response)
logThis(response,str(channel.id))
if showImage: if showImage:
if deleteImage: if deleteImage:
await oldImage.delete() await oldImage.delete()
oldImage = await channel.send(file = discord.File("resources/games/4InARowBoards/board"+str(channel.id)+".png")) oldImage = await ctx.channel.send(file = discord.File("resources/games/connect4Boards/board"+channelId+".png"))
if gameDone == False: if gameDone == False:
with open("resources/games/oldImages/fourInARow"+str(channel.id), "w") as f: with open("resources/games/oldImages/connectFour"+channelId, "w") as f:
f.write(str(oldImage.id)) f.write(str(oldImage.id))
try: try:
reactions = ["1","2","3","4","5","6","7"] reactions = ["1","2","3","4","5","6","7"]
@ -63,7 +63,7 @@ class GameLoops():
logThis("Image deleted before I could react to all of them") logThis("Image deleted before I could react to all of them")
else: else:
with open("resources/games/oldImages/fourInARow"+str(channel.id), "w") as f: with open("resources/games/oldImages/connectFour"+channelId, "w") as f:
f.write(str(oldImage.id)) f.write(str(oldImage.id))
try: try:
reactions = ["1","2","3","4","5","6","7"] reactions = ["1","2","3","4","5","6","7"]
@ -73,10 +73,10 @@ class GameLoops():
logThis("Image deleted before I could react to all of them") logThis("Image deleted before I could react to all of them")
if gameDone: if gameDone:
game = self.bot.database["4 in a row games"].find_one({"_id":str(channel.id)}) game = self.bot.database["connect 4 games"].find_one({"_id":channelId})
try: try:
with open("resources/games/oldImages/fourInARow"+str(channel.id), "r") as f: with open("resources/games/oldImages/connectFour"+channelId, "r") as f:
oldImage = await channel.fetch_message(int(f.read())) oldImage = await channel.fetch_message(int(f.read()))
await oldImage.delete() await oldImage.delete()
@ -90,15 +90,18 @@ class GameLoops():
if game["players"][winner-1].lower() != "gwendolyn": if game["players"][winner-1].lower() != "gwendolyn":
self.bot.money.addMoney(game["players"][winner-1].lower(),reward) self.bot.money.addMoney(game["players"][winner-1].lower(),reward)
self.bot.funcs.deleteGame("4 in a row games",str(channel.id)) self.bot.funcs.deleteGame("connect 4 games",channelId)
async def runHangman(self,channel,user,command = "start"): async def runHangman(self,channel,user,command = "start", ctx = None):
try: try:
response, showImage, deleteImage, remainingLetters = self.bot.hangman.parseHangman(str(channel.id),user,command) response, showImage, deleteImage, remainingLetters = self.bot.hangman.parseHangman(str(channel.id),user,command)
except: except:
logThis("Error parsing command (error code 1701)") logThis("Error parsing command (error code 1701)")
if response != "": if response != "":
if ctx is None:
await channel.send(response) await channel.send(response)
else:
await ctx.send(response)
logThis(response,str(channel.id)) logThis(response,str(channel.id))
if showImage: if showImage:
if deleteImage: if deleteImage:
@ -127,44 +130,45 @@ class GameLoops():
logThis("Image deleted before adding all reactions") logThis("Image deleted before adding all reactions")
# Runs Hex # Runs Hex
async def runHex(self,channel,command,user): async def runHex(self,ctx,command,user):
channelId = ctx.channel_id
try: try:
response, showImage, deleteImage, gameDone, gwendoTurn = self.bot.hex.parseHex(command,str(channel.id),user) response, showImage, deleteImage, gameDone, gwendoTurn = self.bot.hex.parseHex(command,str(channelId),user)
except: except:
logThis("Error parsing command (error code 1510)") logThis("Error parsing command (error code 1510)")
await channel.send(response) await ctx.send(response)
logThis(response,str(channel.id)) logThis(response,str(channelId))
if showImage: if showImage:
if deleteImage: if deleteImage:
try: try:
oldImage = await self.deleteMessage("hex"+str(channel.id),channel) oldImage = await self.deleteMessage("hex"+str(channelId),ctx.channel)
except: except:
logThis("Error deleting old image (error code 1501)") logThis("Error deleting old image (error code 1501)")
oldImage = await channel.send(file = discord.File("resources/games/hexBoards/board"+str(channel.id)+".png")) oldImage = await ctx.channel.send(file = discord.File("resources/games/hexBoards/board"+str(channelId)+".png"))
if gwendoTurn and not gameDone: if gwendoTurn and not gameDone:
try: try:
response, showImage, deleteImage, gameDone, gwendoTurn = self.bot.hex.hexAI(str(channel.id)) response, showImage, deleteImage, gameDone, gwendoTurn = self.bot.hex.hexAI(str(channelId))
except: except:
response, showImage, deleteImage, gameDone, gwendoTurn = "An AI error occured",False,False,False,False response, showImage, deleteImage, gameDone, gwendoTurn = "An AI error ocurred",False,False,False,False
logThis("AI error (error code 1520)") logThis("AI error (error code 1520)")
await channel.send(response) await ctx.channel.send(response)
logThis(response,str(channel.id)) logThis(response,str(channelId))
if showImage: if showImage:
if deleteImage: if deleteImage:
await oldImage.delete() await oldImage.delete()
oldImage = await channel.send(file = discord.File("resources/games/hexBoards/board"+str(channel.id)+".png")) oldImage = await ctx.channel.send(file = discord.File("resources/games/hexBoards/board"+str(channelId)+".png"))
if not gameDone: if not gameDone:
with open("resources/games/oldImages/hex"+str(channel.id), "w") as f: with open("resources/games/oldImages/hex"+str(channelId), "w") as f:
f.write(str(oldImage.id)) f.write(str(oldImage.id))
if gameDone: if gameDone:
game = self.bot.database["hex games"].find_one({"_id":str(channel.id)}) game = self.bot.database["hex games"].find_one({"_id":str(channelId)})
winner = game["winner"] winner = game["winner"]
if winner != 0 and game["players"][0] != game["players"][1]: # player1 != player2 if winner != 0 and game["players"][0] != game["players"][1]: # player1 != player2
winnings = game["difficulty"]*10 winnings = game["difficulty"]*10
self.bot.money.addMoney(game["players"][winner-1].lower(),winnings) self.bot.money.addMoney(game["players"][winner-1].lower(),winnings)
self.bot.funcs.deleteGame("hex games",str(channel.id)) self.bot.funcs.deleteGame("hex games",str(channelId))

View File

@ -1,7 +1,7 @@
from .invest import Invest from .invest import Invest
from .trivia import Trivia from .trivia import Trivia
from .blackjack import Blackjack from .blackjack import Blackjack
from .fourInARow import FourInARow from .connectFour import connectFour
from .gameLoops import GameLoops from .gameLoops import GameLoops
from .hangman import Hangman from .hangman import Hangman
from .hex import HexGame from .hex import HexGame
@ -13,7 +13,7 @@ class Games():
bot.invest = Invest(bot) bot.invest = Invest(bot)
bot.trivia = Trivia(bot) bot.trivia = Trivia(bot)
bot.blackjack = Blackjack(bot) bot.blackjack = Blackjack(bot)
bot.fourInARow = FourInARow(bot) bot.connectFour = connectFour(bot)
bot.gameLoops = GameLoops(bot) bot.gameLoops = GameLoops(bot)
bot.hangman = Hangman(bot) bot.hangman = Hangman(bot)
bot.hex = HexGame(bot) bot.hex = HexGame(bot)

View File

@ -196,7 +196,7 @@ class HexGame():
else: else:
return "There's no game in this channel", False, False, False, False return "There's no game in this channel", False, False, False, False
# Returns a board where the placement has occured # Returns a board where the placement has ocurred
def placeOnHexBoard(self, board,player,position): def placeOnHexBoard(self, board,player,position):
# Translates the position # Translates the position
position = position.lower() position = position.lower()

View File

@ -173,21 +173,21 @@ class SwRoll():
emoji = "" emoji = ""
for char in result: for char in result:
if char == 'S': if char == 'S':
emoji += "<:success:690971244971163718> " emoji += "<:success:826026925280854026> "
elif char == 'A': elif char == 'A':
emoji += "<:advantage:690970761611051079> " emoji += "<:advantage:826026925515604009> "
elif char == 'R': elif char == 'R':
emoji += "<:swtriumph:690971267486187643> " emoji += "<:triumph:826026925319127070> "
elif char == 'F': elif char == 'F':
emoji += "<:failure:690970957786906664> " emoji += "<:failure:826026925288980511> "
elif char == 'H': elif char == 'H':
emoji += "<:threat:690971009469382656> " emoji += "<:threat:826026925280985108> "
elif char == 'D': elif char == 'D':
emoji += "<:despair:690971200163414238> " emoji += "<:despair:826026925272203294> "
elif char == 'L': elif char == 'L':
emoji += "<:light:691010089905029171>" emoji += "<:light:826026925059211295>"
elif char == 'B': elif char == 'B':
emoji += "<:dark:691010101901000852>" emoji += "<:dark:826026925289373717>"
return emoji return emoji

View File

@ -99,7 +99,7 @@
1340 - Error in drawing blackjack table 1340 - Error in drawing blackjack table
1341 - Error in drawHand() 1341 - Error in drawHand()
14 - Four in a row 14 - connect four
1400 - Unspecified error 1400 - Unspecified error
1401 - Error deleting old image 1401 - Error deleting old image
1410 - Unspecified parsing error 1410 - Unspecified parsing error

View File

@ -0,0 +1 @@
Brug `!connectFour start` til at starte et spil imod Gwendolyn. Brug `!connectFour start [modstander]` for at spille imod en anden person. Du kan også bruge `!connectFour start [1-5]`, hvor tallet er sværhedsgraden af Gwendolyn du gerne vil spille imod.

View File

@ -1 +0,0 @@
Brug `!fourinarow start` til at starte et spil imod Gwendolyn. Brug `!fourinarow start [modstander]` for at spille imod en anden person. Du kan også bruge `!fourinarow start [1-5]`, hvor tallet er sværhedsgraden af Gwendolyn du gerne vil spille imod.

View File

@ -1 +0,0 @@
Få et billede af Senkulpa kortet.

View File

@ -0,0 +1 @@
Du kan bruge kommandoer som `!starWarsCharacter name Jared` eller `!starWarsCharacter skills astrogation 3` til at ændre din karakters info. Kommandoen `!starWarsCharacter` vil give dig et character sheet for din karakter.

View File

@ -1 +1 @@
Lader dig rulle Star Wars terninger. Du kan skrive tal der repræsenterer antallet af hver terning i rækkefølgen: ability, proficiency, difficulty, challenge, boost, setback og force. Du behøver ikke skrive et tal til alle terningerne. Du kan også skrive forbogstavet for terningen du vil rulle før antallet, såsom "!swroll f2", der ruller 2 force terninger. Lader dig rulle Star Wars terninger. Du kan skrive tal der repræsenterer antallet af hver terning i rækkefølgen: ability, proficiency, difficulty, challenge, boost, setback og force. Du behøver ikke skrive et tal til alle terningerne. Du kan også skrive forbogstavet for terningen du vil rulle før antallet, såsom "!starWarsRoll f2", der ruller 2 force terninger.

View File

@ -1 +0,0 @@
Du kan bruge kommandoer som `!swchar name Jared` eller `!swchar skills astrogation 3` til at ændre din karakters info. Kommandoen `!swchar` vil give dig et character sheet for din karakter.

View File

@ -6,8 +6,6 @@
`!monster` - Slå et monster op. `!monster` - Slå et monster op.
`!map` - Få et billede af Senkulpa kortet.
`!image` - Finder et tilfældigt billede fra internettet. `!image` - Finder et tilfældigt billede fra internettet.
`!movie` - Giver titlen på en tilfældig film fra Bedre Netflix `!movie` - Giver titlen på en tilfældig film fra Bedre Netflix
@ -18,9 +16,9 @@
`!give` - Lader dig give GwendoBucks til andre. `!give` - Lader dig give GwendoBucks til andre.
`!swchar` - Lader dig lave en Star Wars karakter. `!starWarsCharacter` - Lader dig lave en Star Wars karakter.
`!swroll` - Lader dig rulle Star Wars terninger. `!starWarsRoll` - Lader dig rulle Star Wars terninger.
`!balance` - Viser dig hvor mange GwendoBucks du har. `!balance` - Viser dig hvor mange GwendoBucks du har.
@ -30,7 +28,7 @@
`!trivia` - Lader dig spille et spil trivia, hvor du kan tjene GwendoBucks. `!trivia` - Lader dig spille et spil trivia, hvor du kan tjene GwendoBucks.
`!fourinarow` - Lader dig spille et spil fire på stribe. `!connectFour` - Lader dig spille et spil fire på stribe.
`!hex` - Lader dig spille et spil Hex. `!hex` - Lader dig spille et spil Hex.

View File

@ -23,6 +23,68 @@
} }
] ]
}, },
"balance" : {
"name" : "balance",
"description" : "See your balance of GwendoBucks"
},
"blackjack" : {
"name" : "blackjack",
"description" : "Run a game of blackjack",
"options" : [
{
"name" : "parameters",
"description" : "The parameters for the command",
"type" : 3,
"required" : "false"
}
]
},
"connectFourStartGwendolyn" : {
"base" : "connectFour",
"subcommand_group" : "start",
"name" : "Gwendolyn",
"description" : "Start a game of connect four against Gwendolyn",
"options" : [
{
"name" : "difficulty",
"description" : "The difficulty of Gwendolyn's AI",
"type" : 4,
"required" : "false"
}
]
},
"connectFourStartUser" : {
"base" : "connectFour",
"subcommand_group" : "start",
"name" : "user",
"description" : "Start a game of connect four against another user",
"options" : [
{
"name" : "user",
"description" : "The user to start a game against",
"type" : 6,
"required" : "true"
}
]
},
"connectFourStop" : {
"base" : "connectFour",
"name" : "stop",
"description" : "Stop the game of connect four"
},
"connectFourPlace" : {
"base" : "connectFour",
"name" : "place",
"description" : "Place a piece",
"options" : [
{
"name" : "column",
"description" : "The column to place the piece",
"type" : 4,
"required" : "true"
}
]
},
"downloading" : { "downloading" : {
"name" : "downloading", "name" : "downloading",
"description" : "See current downloads for Bedre Netflix", "description" : "See current downloads for Bedre Netflix",
@ -47,6 +109,28 @@
} }
] ]
}, },
"give" : {
"name" : "give",
"description" : "Give GwendoBucks to another user",
"options" : [
{
"name" : "parameters",
"description" : "The user and amount of GwendoBucks you're sending",
"type" : 3,
"required" : "true"
}
]
},
"hangmanStart" : {
"base" : "hangman",
"name" : "start",
"description" : "Start a game of hangman"
},
"hangmanStop" : {
"base" : "hangman",
"name" : "stop",
"description" : "Stop the current game of hangman"
},
"hello" : { "hello" : {
"name" : "hello", "name" : "hello",
"description" : "Greet Gwendolyn" "description" : "Greet Gwendolyn"
@ -63,6 +147,74 @@
} }
] ]
}, },
"hexPlace" : {
"base" : "hex",
"name" : "place",
"description" : "Place a piece on the hex board",
"options" : [
{
"name" : "coordinates",
"description" : "The coordinates to place the piece at",
"type" : 3,
"required" : "true"
}
]
},
"hexStartGwendolyn" : {
"base" : "hex",
"subcommand_group" : "start",
"name" : "Gwendolyn",
"description" : "Start a game of hex against Gwendolyn",
"options" : [
{
"name" : "difficulty",
"description" : "The difficulty of Gwendolyn's AI",
"type" : 4,
"required" : "false"
}
]
},
"hexStartUser" : {
"base" : "hex",
"subcommand_group" : "start",
"name" : "user",
"description" : "Start a game of hex against another user",
"options" : [
{
"name" : "user",
"description" : "The user to start a game against",
"type" : 6,
"required" : "true"
}
]
},
"hexSurrender" : {
"base" : "hex",
"name" : "surrender",
"description" : "Surrender the game of hex"
},
"hexSwap" : {
"base" : "hex",
"name" : "swap",
"description" : "Perform a hex swap"
},
"hexUndo" : {
"base" : "hex",
"name" : "undo",
"description" : "Undo your last hex move"
},
"invest" : {
"name" : "invest",
"description" : "Invest GwendoBucks in the stock market",
"options" : [
{
"name" : "parameters",
"description" : "The parameters for the command",
"type" : 3,
"required" : "false"
}
]
},
"image" : { "image" : {
"name" : "image", "name" : "image",
"description" : "Get a random image from Bing" "description" : "Get a random image from Bing"
@ -115,6 +267,54 @@
} }
] ]
}, },
"starWarsCharacter" : {
"name" : "starWarsCharacter",
"description" : "Manage your Star Wars character sheet",
"options" : [
{
"name" : "parameters",
"description" : "The parameters for the command",
"type" : 3,
"required" : "false"
}
]
},
"starWarsCrit" : {
"name" : "starWarsCrit",
"description" : "Roll a Star Wars critical injury",
"options" : [
{
"name" : "severity",
"description" : "The severity of the hit",
"type" : 4,
"required" : "true"
}
]
},
"starWarsDestiny" : {
"name" : "starWarsDestiny",
"description" : "Use and see Star Wars Destiny points",
"options" : [
{
"name" : "parameters",
"description" : "The parameters for the command",
"type" : 3,
"required" : "false"
}
]
},
"starWarsRoll" : {
"name" : "starWarsRoll",
"description" : "Roll Star Wars dice",
"options" : [
{
"name" : "dice",
"description" : "The dice, or ability, to roll",
"type" : 3,
"required" : "false"
}
]
},
"stop" : { "stop" : {
"name" : "stop", "name" : "stop",
"description" : "Restart Gwendolyn" "description" : "Restart Gwendolyn"
@ -127,6 +327,18 @@
"name" : "thank", "name" : "thank",
"description" : "Thank Gwendolyn for her service" "description" : "Thank Gwendolyn for her service"
}, },
"trivia" : {
"name" : "trivia",
"description" : "Play a game of trivia",
"options" : [
{
"name" : "answer",
"description" : "Your answer to the trivia question",
"type" : 3,
"required" : "false"
}
]
},
"wiki" : { "wiki" : {
"name" : "wiki", "name" : "wiki",
"description" : "Searches for and gets the info for a wiki page", "description" : "Searches for and gets the info for a wiki page",

View File

@ -60,11 +60,11 @@
"resources/movies.txt": "The Room", "resources/movies.txt": "The Room",
"resources/names.txt": "Gandalf", "resources/names.txt": "Gandalf",
"credentials.txt" : "Bot token: TOKEN\nFinnhub API key: KEY\nWordnik API Key: KEY\nMongoDB user: USERNAME\nMongoDB password: PASSWORD\nWolframAlpha AppID: APPID\nRadarr API key: KEY\nSonarr API key: KEY", "credentials.txt" : "Bot token: TOKEN\nFinnhub API key: KEY\nWordnik API Key: KEY\nMongoDB user: USERNAME\nMongoDB password: PASSWORD\nWolframAlpha AppID: APPID\nRadarr API key: KEY\nSonarr API key: KEY",
"options.txt" : "Testing: True" "options.txt" : "Testing: True\nTesting guild id:\nAdmins:"
}, },
"folder" : [ "folder" : [
"resources/games/blackjackTables", "resources/games/blackjackTables",
"resources/games/4InARowBoards", "resources/games/connect4Boards",
"resources/games/hexBoards", "resources/games/hexBoards",
"resources/games/hangmanBoards", "resources/games/hangmanBoards",
"resources/bedreNetflix" "resources/bedreNetflix"