T
T
Tutela2021-06-14 19:23:35
SQLite
Tutela, 2021-06-14 19:23:35

SQLite python database not being created, what should I do?

I created my own bot project for discord on python.
It was necessary to create a sqlite database to record users and their balance, after launch, the database was not created, I don’t know why?
Here is the code:

import discord
from discord.ext import commands
import sqlite3
from config import settings

client = commands.Bot(command_prefix = settings['PREFIX'])
client.remove_command('help')

connection = sqlite3.connect('server.db')
cursor = connection.cursor()

@client.event
async def on_ready():
    cursor.execute("""CREATE TABLE IF NOT EXISTS users (name TEXT, id INT, cash BIGINT )""")
    connection.commit()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question