Created
May 13, 2018 18:06
-
-
Save NexInfinite/bfc5a8283c3395e66b8f98377f256d01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
from NewCommandLib import * | |
from ChatBotCommands import * | |
from No3rdPartLibCode import * | |
conn = sqlite3.connect('newcommand.db') | |
c = conn.cursor() | |
c.execute("""CREATE TABLE IF NOT EXISTS newcommand( | |
command text, | |
response text | |
)""") | |
def insert_cmd(command_given, response_given): | |
with conn: | |
c.execute("INSERT INTO `newcommand` VALUES (:command, :response)", {'command': command_given, 'response': ' '.join(response_given)}) | |
pass | |
def get_cmd_command(command): | |
with conn: | |
c.execute("SELECT command FROM 'newcommand' WHERE command = (:command)", {'command': command}) | |
def get_cmd_response(command): | |
with conn: | |
c.execute("SELECT response FROM 'newcommand' WHERE command = (:command)", {'command': command}) | |
return c.fetchone() | |
if __name__ == '__main__': | |
conn.commit() | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment