Modifications
* stderr * Refactor * Rename db from sqlite3 to sqlite extension
This commit is contained in:
parent
1a630d73dc
commit
f979b8c4c1
4 changed files with 6 additions and 8 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,4 +6,4 @@ __pycache__
|
|||
.vscode/
|
||||
|
||||
.env
|
||||
*.sqlite3
|
||||
*.sqlite
|
||||
|
|
|
@ -21,9 +21,6 @@ class Commandes(Cog):
|
|||
self.prefix = load(["PREFIX"])["PREFIX"]
|
||||
self.not_a_mod = "tu n'es pas modérateur"
|
||||
self.unknown_command = "cette commande n'existe pas"
|
||||
self.existing_command = (
|
||||
f"cette commande existe déjà, {self.prefix}edit <name> <msg> pour l'éditer"
|
||||
)
|
||||
|
||||
@new(name="add", aliases=["ajout", "ajouter"], no_global_checks=True)
|
||||
async def _add(
|
||||
|
@ -43,7 +40,7 @@ class Commandes(Cog):
|
|||
CommandesDB().ajoutCommande(name, message)
|
||||
await ctx.send(f"@{ctx.author.name}, commande {name} ajoutée !")
|
||||
else:
|
||||
await ctx.send(f"@{ctx.author.name}, {self.existing_command}.")
|
||||
await ctx.send(f"@{ctx.author.name}, cette commande existe déjà.")
|
||||
else:
|
||||
await ctx.send(f"@{ctx.author.name}, {self.not_a_mod}.")
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from utils.db import Database
|
|||
|
||||
class CommandesDB(Database):
|
||||
def __init__(self):
|
||||
super().__init__(r"db/bot.sqlite3")
|
||||
super().__init__(r"db/bot.sqlite")
|
||||
|
||||
def creationTable(self) -> None:
|
||||
"""Créer la table qui stocker les commandes."""
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from sqlite3 import Connection, Cursor, Error, connect
|
||||
from sys import stderr
|
||||
|
||||
|
||||
class Database:
|
||||
|
@ -18,7 +19,7 @@ class Database:
|
|||
try:
|
||||
connnexion = connect(path)
|
||||
except Error as e:
|
||||
print(e)
|
||||
print(e, file=stderr)
|
||||
return connnexion
|
||||
|
||||
def _fileExists(self, path: str) -> bool:
|
||||
|
@ -45,7 +46,7 @@ class Database:
|
|||
self.connexion.commit()
|
||||
return (curseur, curseur.lastrowid)
|
||||
except Error as e:
|
||||
print(e)
|
||||
print(e, file=stderr)
|
||||
|
||||
def getResults(self, curseur: _cursor) -> list[tuple]:
|
||||
"""Affiche le résultat d'une requête"""
|
||||
|
|
Loading…
Reference in a new issue