sql works

This commit is contained in:
lickthecheese 2020-02-19 11:37:00 -05:00
parent c638143448
commit 1e0225bea4
1 changed files with 18 additions and 1 deletions

View File

@ -1,7 +1,24 @@
# load me
import sqlite3
def sql(self, c,n,m):
self.say(c,n)
if n == 'lickthecheese':
try:
conn = sqlite3.connect('database.db')
co = conn.cursor()
co.execute(m[4:])
a = co.fetchall()
if len(a) > 0:
self.say(c,' '.join(a))
else:
self.say(c, 'no output')
conn.commit()
conn.close()
except:
self.say(c, 'invalid sql statement')
else:
self.say(c, 'this command is for the bot owner only')
def init(self):
self.registerCommand('sql', sql)