made calculator a seperate file, added to list
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
ledger.db
|
ledger.db
|
||||||
__pycache__/*
|
__pycache__/*
|
||||||
|
*.drawio
|
||||||
131
Acronymbot.py
131
Acronymbot.py
@@ -2,6 +2,7 @@ import discord
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from BlackJack import BlackJack
|
from BlackJack import BlackJack
|
||||||
|
from Calculator import Calculator
|
||||||
|
|
||||||
botIntents = discord.Intents.all()
|
botIntents = discord.Intents.all()
|
||||||
|
|
||||||
@@ -105,133 +106,6 @@ async def bal(interaction: discord.Interaction):
|
|||||||
"""
|
"""
|
||||||
#### Calculator ####
|
#### Calculator ####
|
||||||
"""
|
"""
|
||||||
class Calculator(discord.ui.View):
|
|
||||||
def __init__(self, *, timeout=180):
|
|
||||||
super().__init__(timeout=timeout)
|
|
||||||
self.numDigs = 0
|
|
||||||
self.MAXIMUMBARSIZE = 30
|
|
||||||
m = 0
|
|
||||||
self.inputOne = 0
|
|
||||||
self.inputTwo = None
|
|
||||||
self.expression = None
|
|
||||||
self.output = None
|
|
||||||
self.digit = 1
|
|
||||||
self.addition = lambda x, y: x + y
|
|
||||||
self.subtraction = lambda x, y: x - y
|
|
||||||
self.multiplication = lambda x, y: x * y
|
|
||||||
self.division = lambda x, y: x / y
|
|
||||||
self.exponent = lambda x, y: x ** y
|
|
||||||
self.funckyDict = {
|
|
||||||
self.addition: "+",
|
|
||||||
self.subtraction: "-",
|
|
||||||
self.multiplication: "*",
|
|
||||||
self.division: "/",
|
|
||||||
self.exponent: "^"
|
|
||||||
}
|
|
||||||
|
|
||||||
def numDigits(self, integer):
|
|
||||||
numDigits = 0
|
|
||||||
while(integer):
|
|
||||||
numDigits += 1
|
|
||||||
integer = integer // 10
|
|
||||||
return numDigits
|
|
||||||
|
|
||||||
def display(self):
|
|
||||||
inputOneLength = self.numDigits(self.inputOne)
|
|
||||||
inputTwoLength = self.numDigits(self.inputTwo)
|
|
||||||
outputLength = self.numDigits(self.output)
|
|
||||||
if (self.inputTwo is None) and (self.output is None):
|
|
||||||
padding = self.MAXIMUMBARSIZE - inputOneLength - 1
|
|
||||||
displayOutput = " ".join(['`', ' ' * padding, f"{self.inputOne}", "`"])
|
|
||||||
elif (self.output is None):
|
|
||||||
padding = self.MAXIMUMBARSIZE - inputOneLength - inputTwoLength - 3
|
|
||||||
displayOutput = " ".join(['`', ' ' * padding, f"{self.inputTwo}", f"{self.funckyDict[self.expression]}", f"{self.inputOne}", "`"])
|
|
||||||
else:
|
|
||||||
padding = self.MAXIMUMBARSIZE - inputOneLength - inputTwoLength - outputLength - 4
|
|
||||||
displayOutput = " ".join(['`', ' ' * padding, f"{self.inputTwo}", f"{self.funckyDict[self.expression]}", f"{self.inputOne}", "=", f"{self.output}", "`"])
|
|
||||||
return displayOutput
|
|
||||||
|
|
||||||
async def number(self, interaction: discord.Interaction, number):
|
|
||||||
self.inputOne = self.inputOne * 10 + number
|
|
||||||
self.numDigs = self.numDigs + 1
|
|
||||||
await interaction.response.edit_message(
|
|
||||||
content=self.display(),
|
|
||||||
view=self)
|
|
||||||
|
|
||||||
async def operator(self, interaction: discord.Interaction, operation):
|
|
||||||
self.inputTwo = self.inputOne
|
|
||||||
self.inputOne = 0
|
|
||||||
self.expression = operation
|
|
||||||
await interaction.response.edit_message(
|
|
||||||
content=self.display(),
|
|
||||||
view=self)
|
|
||||||
|
|
||||||
@discord.ui.button(label="^", style=discord.ButtonStyle.red, row=4)
|
|
||||||
async def power(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.operator(interaction, self.exponent)
|
|
||||||
|
|
||||||
@discord.ui.button(label="0", style=discord.ButtonStyle.blurple,row=4)
|
|
||||||
async def zero(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 0)
|
|
||||||
|
|
||||||
@discord.ui.button(label="1", style=discord.ButtonStyle.blurple, row=1)
|
|
||||||
async def one(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 1)
|
|
||||||
|
|
||||||
@discord.ui.button(label="2", style=discord.ButtonStyle.blurple, row=1)
|
|
||||||
async def two(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 2)
|
|
||||||
|
|
||||||
@discord.ui.button(label="3", style=discord.ButtonStyle.blurple, row=1)
|
|
||||||
async def three(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 3)
|
|
||||||
|
|
||||||
@discord.ui.button(label="4", style=discord.ButtonStyle.blurple, row=2)
|
|
||||||
async def four(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 4)
|
|
||||||
|
|
||||||
@discord.ui.button(label="5", style=discord.ButtonStyle.blurple, row=2)
|
|
||||||
async def five(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 5)
|
|
||||||
|
|
||||||
@discord.ui.button(label="6", style=discord.ButtonStyle.blurple, row=2)
|
|
||||||
async def six(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 6)
|
|
||||||
|
|
||||||
@discord.ui.button(label="7", style=discord.ButtonStyle.blurple, row=3)
|
|
||||||
async def seven(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 7)
|
|
||||||
|
|
||||||
@discord.ui.button(label="8", style=discord.ButtonStyle.blurple, row=3)
|
|
||||||
async def eight(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 8)
|
|
||||||
|
|
||||||
@discord.ui.button(label="9", style=discord.ButtonStyle.blurple, row=3)
|
|
||||||
async def nine(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.number(interaction, 9)
|
|
||||||
|
|
||||||
@discord.ui.button(label="+", style=discord.ButtonStyle.red, row=1)
|
|
||||||
async def plus(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.operator(interaction, self.addition)
|
|
||||||
|
|
||||||
@discord.ui.button(label="*", style=discord.ButtonStyle.red, row=2)
|
|
||||||
async def mult(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.operator(interaction, self.multiplication)
|
|
||||||
|
|
||||||
@discord.ui.button(label="-", style=discord.ButtonStyle.red, row=3)
|
|
||||||
async def minus(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.operator(interaction, self.subtraction)
|
|
||||||
|
|
||||||
@discord.ui.button(label="=", style=discord.ButtonStyle.green, row=4)
|
|
||||||
async def equals(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
self.output = self.expression(self.inputTwo, self.inputOne)
|
|
||||||
await interaction.response.edit_message(
|
|
||||||
content=self.display(),
|
|
||||||
view=self)
|
|
||||||
|
|
||||||
@discord.ui.button(label="/", style=discord.ButtonStyle.red, row=4)
|
|
||||||
async def divide(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
||||||
await self.operator(interaction, self.division)
|
|
||||||
|
|
||||||
@tree.command(description="Do Meth")
|
@tree.command(description="Do Meth")
|
||||||
async def calculator(interaction: discord.Interaction):
|
async def calculator(interaction: discord.Interaction):
|
||||||
@@ -239,9 +113,6 @@ async def calculator(interaction: discord.Interaction):
|
|||||||
calculator = Calculator()
|
calculator = Calculator()
|
||||||
await interaction.followup.send(content="`" + " " * calculator.MAXIMUMBARSIZE + "0`", view=calculator)
|
await interaction.followup.send(content="`" + " " * calculator.MAXIMUMBARSIZE + "0`", view=calculator)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#### Fin ####
|
#### Fin ####
|
||||||
"""
|
"""
|
||||||
|
|||||||
131
Calculator.py
Normal file
131
Calculator.py
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
import discord
|
||||||
|
|
||||||
|
class Calculator(discord.ui.View):
|
||||||
|
def __init__(self, *, timeout=180):
|
||||||
|
super().__init__(timeout=timeout)
|
||||||
|
self.numDigs = 0
|
||||||
|
self.MAXIMUMBARSIZE = 30
|
||||||
|
m = 0
|
||||||
|
self.inputOne = 0
|
||||||
|
self.inputTwo = None
|
||||||
|
self.expression = None
|
||||||
|
self.output = None
|
||||||
|
self.digit = 1
|
||||||
|
self.addition = lambda x, y: x + y
|
||||||
|
self.subtraction = lambda x, y: x - y
|
||||||
|
self.multiplication = lambda x, y: x * y
|
||||||
|
self.division = lambda x, y: x / y
|
||||||
|
self.exponent = lambda x, y: x ** y
|
||||||
|
self.funckyDict = {
|
||||||
|
self.addition: "+",
|
||||||
|
self.subtraction: "-",
|
||||||
|
self.multiplication: "*",
|
||||||
|
self.division: "/",
|
||||||
|
self.exponent: "^"
|
||||||
|
}
|
||||||
|
|
||||||
|
def numDigits(self, integer):
|
||||||
|
numDigits = 0
|
||||||
|
while(integer):
|
||||||
|
numDigits += 1
|
||||||
|
integer = integer // 10
|
||||||
|
return numDigits
|
||||||
|
|
||||||
|
def display(self):
|
||||||
|
inputOneLength = self.numDigits(self.inputOne)
|
||||||
|
inputTwoLength = self.numDigits(self.inputTwo)
|
||||||
|
outputLength = self.numDigits(self.output)
|
||||||
|
if (self.inputTwo is None) and (self.output is None):
|
||||||
|
padding = self.MAXIMUMBARSIZE - inputOneLength - 1
|
||||||
|
displayOutput = " ".join(['`', ' ' * padding, f"{self.inputOne}", "`"])
|
||||||
|
elif (self.output is None):
|
||||||
|
padding = self.MAXIMUMBARSIZE - inputOneLength - inputTwoLength - 3
|
||||||
|
displayOutput = " ".join(['`', ' ' * padding, f"{self.inputTwo}", f"{self.funckyDict[self.expression]}", f"{self.inputOne}", "`"])
|
||||||
|
else:
|
||||||
|
padding = self.MAXIMUMBARSIZE - inputOneLength - inputTwoLength - outputLength - 4
|
||||||
|
displayOutput = " ".join(['`', ' ' * padding, f"{self.inputTwo}", f"{self.funckyDict[self.expression]}", f"{self.inputOne}", "=", f"{self.output}", "`"])
|
||||||
|
return displayOutput
|
||||||
|
|
||||||
|
async def number(self, interaction: discord.Interaction, number):
|
||||||
|
self.inputOne = self.inputOne * 10 + number
|
||||||
|
self.numDigs = self.numDigs + 1
|
||||||
|
await interaction.response.edit_message(
|
||||||
|
content=self.display(),
|
||||||
|
view=self)
|
||||||
|
|
||||||
|
async def operator(self, interaction: discord.Interaction, operation):
|
||||||
|
self.inputTwo = self.inputOne
|
||||||
|
self.inputOne = 0
|
||||||
|
self.expression = operation
|
||||||
|
await interaction.response.edit_message(
|
||||||
|
content=self.display(),
|
||||||
|
view=self)
|
||||||
|
|
||||||
|
@discord.ui.button(label="^", style=discord.ButtonStyle.red, row=4)
|
||||||
|
async def power(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.operator(interaction, self.exponent)
|
||||||
|
|
||||||
|
@discord.ui.button(label="0", style=discord.ButtonStyle.blurple,row=4)
|
||||||
|
async def zero(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 0)
|
||||||
|
|
||||||
|
@discord.ui.button(label="1", style=discord.ButtonStyle.blurple, row=1)
|
||||||
|
async def one(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 1)
|
||||||
|
|
||||||
|
@discord.ui.button(label="2", style=discord.ButtonStyle.blurple, row=1)
|
||||||
|
async def two(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 2)
|
||||||
|
|
||||||
|
@discord.ui.button(label="3", style=discord.ButtonStyle.blurple, row=1)
|
||||||
|
async def three(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 3)
|
||||||
|
|
||||||
|
@discord.ui.button(label="4", style=discord.ButtonStyle.blurple, row=2)
|
||||||
|
async def four(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 4)
|
||||||
|
|
||||||
|
@discord.ui.button(label="5", style=discord.ButtonStyle.blurple, row=2)
|
||||||
|
async def five(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 5)
|
||||||
|
|
||||||
|
@discord.ui.button(label="6", style=discord.ButtonStyle.blurple, row=2)
|
||||||
|
async def six(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 6)
|
||||||
|
|
||||||
|
@discord.ui.button(label="7", style=discord.ButtonStyle.blurple, row=3)
|
||||||
|
async def seven(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 7)
|
||||||
|
|
||||||
|
@discord.ui.button(label="8", style=discord.ButtonStyle.blurple, row=3)
|
||||||
|
async def eight(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 8)
|
||||||
|
|
||||||
|
@discord.ui.button(label="9", style=discord.ButtonStyle.blurple, row=3)
|
||||||
|
async def nine(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.number(interaction, 9)
|
||||||
|
|
||||||
|
@discord.ui.button(label="+", style=discord.ButtonStyle.red, row=1)
|
||||||
|
async def plus(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.operator(interaction, self.addition)
|
||||||
|
|
||||||
|
@discord.ui.button(label="*", style=discord.ButtonStyle.red, row=2)
|
||||||
|
async def mult(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.operator(interaction, self.multiplication)
|
||||||
|
|
||||||
|
@discord.ui.button(label="-", style=discord.ButtonStyle.red, row=3)
|
||||||
|
async def minus(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.operator(interaction, self.subtraction)
|
||||||
|
|
||||||
|
@discord.ui.button(label="=", style=discord.ButtonStyle.green, row=4)
|
||||||
|
async def equals(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
self.output = self.expression(self.inputTwo, self.inputOne)
|
||||||
|
if (self.inputTwo == 9) and (self.inputOne == 10):
|
||||||
|
self.output = 21
|
||||||
|
await interaction.response.edit_message(
|
||||||
|
content=self.display(),
|
||||||
|
view=self)
|
||||||
|
|
||||||
|
@discord.ui.button(label="/", style=discord.ButtonStyle.red, row=4)
|
||||||
|
async def divide(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||||
|
await self.operator(interaction, self.division)
|
||||||
19
list.txt
19
list.txt
@@ -1,5 +1,11 @@
|
|||||||
Schema:
|
Schemas -
|
||||||
ID, NAME, WHOOWNSIT, GENRE, BRAINLEVEL, TIMETOPLAY, GAMEPASS
|
GAMEINFO:
|
||||||
|
ID, NAME, GENRE, GAMEPASS
|
||||||
|
WHOOWNSIT (bitmap index):
|
||||||
|
ID, MARCUS, BENSON, ALEX, TIM
|
||||||
|
GAMEFACTORS:
|
||||||
|
ID, BRAINLEVEL, TIMETOPLAY, CAMPAIGN
|
||||||
|
|
||||||
|
|
||||||
Satisfactory MBA
|
Satisfactory MBA
|
||||||
Factorio MBA
|
Factorio MBA
|
||||||
@@ -36,6 +42,15 @@ ROTMG MBAT
|
|||||||
L4D2 MBAT
|
L4D2 MBAT
|
||||||
Unturned MBAT
|
Unturned MBAT
|
||||||
Due Process MBA
|
Due Process MBA
|
||||||
|
Valorant MBAT
|
||||||
|
Terraria MA
|
||||||
|
Modded Minecraft MBAT
|
||||||
|
Warframe MBAT
|
||||||
|
Ghost recon wildlands (if tim buys)
|
||||||
|
Ghost Recon Breakpoint MBA
|
||||||
|
Rocket League BM
|
||||||
|
OW2 MBAT
|
||||||
|
ROBLOX MBAT (Prison Royale)
|
||||||
|
|
||||||
Gamepass Game:
|
Gamepass Game:
|
||||||
Aragami
|
Aragami
|
||||||
|
|||||||
Reference in New Issue
Block a user