Main addition: Russian Roulette

This commit is contained in:
2024-02-18 10:00:21 +10:00
parent bdf4c32e70
commit 686e5d6617
11 changed files with 105 additions and 30 deletions

View File

@@ -121,7 +121,7 @@ async def calculator(interaction: discord.Interaction):
async def gg(interaction: discord.Interaction):
game = pick_game()
await interaction.response.send_message("Barotrauma")
await interaction.response.send_message(f"{game}")
@tree.command(description="Roll a Dice")
@app_commands.choices(dice = [
@@ -138,6 +138,96 @@ async def roll(interaction: discord.Interaction, dice:app_commands.Choice[int]):
roll = random.randint(1, dice.value)
await interaction.response.send_message(f"{dice.name}: {roll}")
"""
#### Russian Roulette ####
"""
MAXLINELENGTH = 12
tooLong = lambda x: len(x) > MAXLINELENGTH
tooShort = lambda x: len(x) < MAXLINELENGTH
difference = lambda x: MAXLINELENGTH - len(x)
sidePad = lambda x: " " * (difference(x) // 2)
evenPad = lambda x: sidePad(x) + x + sidePad(x)
oddPad = lambda x: evenPad(x) + " "
def demon_text_helper(line):
if tooShort(line):
if difference(line) % 2 == 0:
return evenPad(line)
else:
return oddPad(line)
return line
def demon_text(lineOne="", lineTwo="", lineThree=""):
if tooLong(lineOne) or tooLong(lineTwo) or tooLong(lineThree):
print("Line too long lol")
lineOne = demon_text_helper(lineOne)
lineTwo = demon_text_helper(lineTwo)
lineThree = demon_text_helper(lineThree)
demon = f"``` , , /\ /\ \n\
/( /\ )\ _\ \_/ /_ ____________\n\
|\_||_/| < \_ _/ > / \ \n\
\______/ \|0 0|/ | {lineOne} |\n\
_\/_ _(_ ^ _)_ | {lineTwo} |\n\
( () ) /`\|V\"\"\"V|/`\ | {lineThree} |\n\
{{}} \ \_____/ / <______________/\n\
() /\ )=( /\ \n\
{{}} / \_/\=/\_/ \ \n```"
return demon
class ShootOrNoShoot(discord.ui.View):
def __init__(self, *, timeout=180):
super().__init__(timeout=timeout)
self.bullets = 6
@discord.ui.button(label="Shoot", style=discord.ButtonStyle.red)
async def shoot(self, interaction: discord.Interaction, button: discord.ui.Button):
if self.bullets == 0:
for child in self.children:
child.disabled = True
await interaction.response.edit_message(content=f"What?", view=self)
if random.randrange(0,self.bullets) == 0:
for child in self.children:
child.disabled = True
demonDeath = demon_text(lineOne="You died!", lineTwo="Bahahahah!", lineThree=f"Score: {6 - self.bullets}")
await interaction.response.edit_message(content=f"{demonDeath}", view=self)
else:
self.bullets -= 1
button.label = f"Shoot again"
demonLife = demon_text(lineOne="You live", lineTwo="This time!!",
lineThree=f"({6 - self.bullets}/5) blanks")
await interaction.response.edit_message(content=f"{demonLife}", view=self)
@discord.ui.button(label="PussyOut", style=discord.ButtonStyle.blurple)
async def noshoot(self, interaction: discord.Interaction, button: discord.ui.Button):
for child in self.children:
child.disabled = True
demonPussy = demon_text(lineOne="You are such", lineTwo="a huge pussy", lineThree= "0 bitches 4u")
await interaction.response.edit_message(content=f"{demonPussy}", view=self)
@tree.command(description="????")
async def rr(interaction: discord.Interaction):
await interaction.response.defer()
buttons = ShootOrNoShoot()
demon = demon_text(lineTwo="Shoot urself")
await interaction.followup.send(content=f"{demon}", view=buttons)
"""
#### Fin ####
"""