Set some stuff up for werewolf 🐺

This commit is contained in:
NikolajDanger
2020-12-03 15:48:02 +01:00
parent 01553d5ffc
commit d03ae74937
5 changed files with 160 additions and 22 deletions

View File

@ -5,14 +5,14 @@ from funcs import logThis
class GamesCog(commands.Cog):
def __init__(self,client):
def __init__(self,bot):
"""Runs game stuff."""
self.client = client
self.bot = bot
# Checks user balance
@commands.command(aliases = ["b"])
async def balance(self, ctx):
response = self.client.money.checkBalance("#"+str(ctx.message.author.id))
response = self.bot.money.checkBalance("#"+str(ctx.message.author.id))
if response == 1:
new_message = ctx.message.author.display_name + " has " + str(response) + " GwendoBuck"
else:
@ -25,19 +25,19 @@ class GamesCog(commands.Cog):
commands = content.split(" ")
amount = int(commands[-1])
username = " ".join(commands[:-1])
if self.client.funcs.getID(username) == None:
if self.bot.funcs.getID(username) == None:
async for member in ctx.guild.fetch_members(limit=None):
if member.display_name.lower() == username.lower():
username = member.display_name
userID = "#" + str(member.id)
self.client.database["users"].insert_one({"_id":userID,"user name":username,"money":0})
response = self.client.money.giveMoney("#"+str(ctx.message.author.id),username,amount)
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)
await ctx.send(response)
# Invest GwendoBucks in the stock market
@commands.command(aliases=["i"])
async def invest(self, ctx, *, content = "check"):
response = self.client.invest.parseInvest(content,"#"+str(ctx.message.author.id))
response = self.bot.invest.parseInvest(content,"#"+str(ctx.message.author.id))
if response.startswith("**"):
responses = response.split("\n")
em = discord.Embed(title=responses[0],description="\n".join(responses[1:]),colour=0x00FF00)
@ -49,7 +49,7 @@ class GamesCog(commands.Cog):
@commands.command()
async def trivia(self, ctx, *, content = ""):
if content == "":
question, answers, correctAnswer = self.client.trivia.triviaStart(str(ctx.message.channel.id))
question, answers, correctAnswer = self.bot.trivia.triviaStart(str(ctx.message.channel.id))
if answers != "":
results = "**"+question+"**\n"
for x, answer in enumerate(answers):
@ -59,9 +59,9 @@ class GamesCog(commands.Cog):
await asyncio.sleep(60)
self.client.trivia.triviaCountPoints(str(ctx.message.channel.id))
self.bot.trivia.triviaCountPoints(str(ctx.message.channel.id))
self.client.funcs.deleteGame("trivia questions",str(ctx.message.channel.id))
self.bot.funcs.deleteGame("trivia questions",str(ctx.message.channel.id))
logThis("Time's up for the trivia question",str(ctx.message.channel.id))
await ctx.send("Time's up The answer was \""+chr(correctAnswer)+") "+answers[correctAnswer-97]+"\". Anyone who answered that has gotten 1 GwendoBuck")
@ -69,7 +69,7 @@ class GamesCog(commands.Cog):
await ctx.send(question)
elif content in ["a","b","c","d"]:
response = self.client.trivia.triviaAnswer("#"+str(ctx.message.author.id),str(ctx.message.channel.id),content)
response = self.bot.trivia.triviaAnswer("#"+str(ctx.message.author.id),str(ctx.message.channel.id),content)
if response.startswith("Locked in "):
await ctx.message.add_reaction("👍")
else:
@ -81,32 +81,37 @@ class GamesCog(commands.Cog):
# Runs a game of blackjack
@commands.command(aliases = ["bj"])
async def blackjack(self, ctx, *, content = ""):
await self.client.blackjack.parseBlackjack(content,ctx)
await self.bot.blackjack.parseBlackjack(content,ctx)
# Runs a game of Connect four
@commands.command(aliases = ["fiar","connect4","connectfour","4iar","4inarow"])
async def fourinarow(self, ctx, *, content = ""):
await self.client.gameLoops.fiar(ctx.message.channel,content,"#"+str(ctx.message.author.id))
await self.bot.gameLoops.fiar(ctx.message.channel,content,"#"+str(ctx.message.author.id))
# Runs a game of Monopoly
@commands.command(aliases = ["m","mon","mono"])
async def monopoly(self, ctx, *, content = ""):
await self.client.gameLoops.runMonopoly(ctx.message.channel,content,"#"+str(ctx.message.author.id))
await self.bot.gameLoops.runMonopoly(ctx.message.channel,content,"#"+str(ctx.message.author.id))
# Runs a game of Hangman
@commands.command(aliases = ["hm"])
async def hangman(self, ctx, *, content = "start"):
await self.client.gameLoops.runHangman(ctx.message.channel,"#"+str(ctx.message.author.id),content)
await self.bot.gameLoops.runHangman(ctx.message.channel,"#"+str(ctx.message.author.id),content)
# Runs a game of Hex
@commands.command(name="hex")
async def hexCommand(self, ctx, *, content = ""):
await self.client.gameLoops.runHex(ctx.message.channel,content,"#"+str(ctx.message.author.id))
await self.bot.gameLoops.runHex(ctx.message.channel,content,"#"+str(ctx.message.author.id))
# Runs a game of Love Letter
@commands.command(aliases = ["ll"])
async def loveletter(self, ctx, *, content = ""):
await self.client.gameLoops.runLoveletter(ctx.message.channel,content,"#"+str(ctx.message.author.id),ctx.message.author)
await self.bot.gameLoops.runLoveletter(ctx.message.channel,content,"#"+str(ctx.message.author.id),ctx.message.author)
def setup(client):
client.add_cog(GamesCog(client))
# Runs a game of Werewolf
@commands.command()
async def werewolf(self,ctx, *,content = "start"):
await self.bot.werewolf.parseWerewolf(ctx,content.lower())
def setup(bot):
bot.add_cog(GamesCog(bot))