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)
|
||||
|
||||
def ajoutCommande(self, name = str, message = str):
|
||||
def ajoutCommande(self, name: str, message: str):
|
||||
"""Ajoute une commande."""
|
||||
requete = """
|
||||
INSERT INTO commandes (
|
||||
|
@ -26,7 +26,7 @@ class CommandesDB(Database):
|
|||
"""
|
||||
self.requete(requete, [name, message])
|
||||
|
||||
def suppressionCommande(self, name = str):
|
||||
def suppressionCommande(self, name: str):
|
||||
"""Supprime une commande."""
|
||||
requete = """
|
||||
DELETE FROM commandes
|
||||
|
@ -37,3 +37,10 @@ class CommandesDB(Database):
|
|||
def listeCommande(self):
|
||||
"""Retourne la liste des 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