Ledger reimplemented with SQLite3

This commit is contained in:
2022-11-28 20:04:16 +10:00
parent e729647f65
commit cb0778bbc2
6 changed files with 63 additions and 50 deletions

View File

@@ -1,7 +1,9 @@
import discord
import sqlite3
from discord import app_commands
from BlackJack import BlackJack
botIntents = discord.Intents.all()
client = discord.Client(intents=botIntents)
@@ -75,7 +77,7 @@ async def bj(interaction: discord.Interaction):
discoutput = lambda m: discordOutput(interaction, m)
blackJack = BlackJack(discinput, discoutput)
await interaction.response.send_message("Let's play Black Jack!")
await blackJack.play_game(interaction.user, 100)
await blackJack.play_game(interaction.user.id, 100)
async def discordInput(interaction: discord.Interaction, message:str):
response = HitOrStand()
@@ -86,6 +88,14 @@ async def discordInput(interaction: discord.Interaction, message:str):
async def discordOutput(interaction: discord.Interaction, message):
await interaction.followup.send(message)
@tree.command(description="Find your Balance")
async def bal(interaction: discord.Interaction):
conn = sqlite3.connect("ledger.db")
cur = conn.cursor()
ID = interaction.user.id
data = cur.execute("SELECT * FROM ledger WHERE USERID = ?", (ID,))
await interaction.response.send_message(data)
"""
#### Fin ####
"""