Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion part1/echobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ def main():


if __name__ == '__main__':
main()
main()
11 changes: 2 additions & 9 deletions part2/dbhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, dbname="todo.sqlite"):

def setup(self):
tblstmt = "CREATE TABLE IF NOT EXISTS items (description text, owner text)"
itemidx = "CREATE INDEX IF NOT EXISTS itemIndex ON items (description ASC)"
itemidx = "CREATE INDEX IF NOT EXISTS itemIndex ON items (description ASC)"
ownidx = "CREATE INDEX IF NOT EXISTS ownIndex ON items (owner ASC)"
self.conn.execute(tblstmt)
self.conn.execute(itemidx)
Expand All @@ -24,18 +24,11 @@ def add_item(self, item_text, owner):

def delete_item(self, item_text, owner):
stmt = "DELETE FROM items WHERE description = (?) AND owner = (?)"
args = (item_text, owner )
args = (item_text, owner)
self.conn.execute(stmt, args)
self.conn.commit()

def get_items(self, owner):
stmt = "SELECT description FROM items WHERE owner = (?)"
args = (owner, )
return [x[0] for x in self.conn.execute(stmt, args)]







2 changes: 1 addition & 1 deletion part2/todobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_last_chat_id_and_text(updates):

def build_keyboard(items):
keyboard = [[item] for item in items]
reply_markup = {"keyboard":keyboard, "one_time_keyboard": True}
reply_markup = {"keyboard": keyboard, "one_time_keyboard": True}
return json.dumps(reply_markup)


Expand Down