check if command exist
This commit is contained in:
parent
d68ed28bbf
commit
2a073723d5
1 changed files with 9 additions and 2 deletions
|
@ -14,7 +14,7 @@ class CommandesDB(Database):
|
||||||
"""
|
"""
|
||||||
self.requete(requete)
|
self.requete(requete)
|
||||||
|
|
||||||
def ajoutCommande(self, name = str, message = str):
|
def ajoutCommande(self, name: str, message: str):
|
||||||
"""Ajoute une commande."""
|
"""Ajoute une commande."""
|
||||||
requete = """
|
requete = """
|
||||||
INSERT INTO commandes (
|
INSERT INTO commandes (
|
||||||
|
@ -26,7 +26,7 @@ class CommandesDB(Database):
|
||||||
"""
|
"""
|
||||||
self.requete(requete, [name, message])
|
self.requete(requete, [name, message])
|
||||||
|
|
||||||
def suppressionCommande(self, name = str):
|
def suppressionCommande(self, name: str):
|
||||||
"""Supprime une commande."""
|
"""Supprime une commande."""
|
||||||
requete = """
|
requete = """
|
||||||
DELETE FROM commandes
|
DELETE FROM commandes
|
||||||
|
@ -37,3 +37,10 @@ class CommandesDB(Database):
|
||||||
def listeCommande(self):
|
def listeCommande(self):
|
||||||
"""Retourne la liste des commandes."""
|
"""Retourne la liste des commandes."""
|
||||||
return self.affichageResultat(self.requete("SELECT * FROM commandes;"))
|
return self.affichageResultat(self.requete("SELECT * FROM commandes;"))
|
||||||
|
|
||||||
|
def existeCommande(self, command: str):
|
||||||
|
commandes = self.listeCommande()
|
||||||
|
for commande in commandes:
|
||||||
|
if commande[0] == command:
|
||||||
|
return (True, commande[1])
|
||||||
|
return (False,)
|
||||||
|
|
Loading…
Reference in a new issue