Add delete_token()

This commit is contained in:
Ceda EI 2019-03-11 18:17:01 +05:30
parent 9261247115
commit f5f81f5a93
1 changed files with 7 additions and 0 deletions

View File

@ -169,4 +169,11 @@ class player():
token = str(uuid.uuid4()) token = str(uuid.uuid4())
query = ('INSERT INTO tokens(chat_id, token) values(?, ?)') query = ('INSERT INTO tokens(chat_id, token) values(?, ?)')
cursor.execute(query, (self.CHAT_ID, token)) cursor.execute(query, (self.CHAT_ID, token))
self.DB.commit()
return token return token
def delete_token(self, token):
cursor = self.DB.cursor()
query = ('DELETE FROM tokens WHERE chat_id = ? AND token = ?')
cursor.execute(query, (self.CHAT_ID, token))
self.DB.commit()