Added a new variable in db that holds responding tweet id

This commit is contained in:
2017-03-05 16:54:43 +01:00
parent c0e05b8909
commit c81d2df9e7

View File

@@ -3,7 +3,7 @@
# @Author: KevinMidboe # @Author: KevinMidboe
# @Date: 2017-03-04 16:50:09 # @Date: 2017-03-04 16:50:09
# @Last Modified by: KevinMidboe # @Last Modified by: KevinMidboe
# @Last Modified time: 2017-03-05 15:54:31 # @Last Modified time: 2017-03-05 16:51:35
import tweepy, sqlite3 import tweepy, sqlite3
from pasteee import Paste from pasteee import Paste
@@ -90,11 +90,11 @@ def lookForNewEpisodes():
def getLastTweets(user, count=1): def getLastTweets(user, count=1):
return api.user_timeline(screen_name=user,count=count) return api.user_timeline(screen_name=user,count=count)
def verifyByID(id): def verifyByID(id, reponse_id):
conn = sqlite3.connect(dbPath) conn = sqlite3.connect(dbPath)
c = conn.cursor() c = conn.cursor()
c.execute('UPDATE stray_episodes SET verified = 1 WHERE tweet_id is "' + id + '"') c.execute('UPDATE stray_episodes SET verified = 1, response_id = ' + reponse_id + ' WHERE tweet_id is "' + id + '"')
conn.commit() conn.commit()
conn.close() conn.close()
@@ -102,7 +102,7 @@ def verifyByID(id):
def parseReply(tweet): def parseReply(tweet):
if b'\xf0\x9f\x91\x8d' in tweet.text.encode('utf-8'): if b'\xf0\x9f\x91\x8d' in tweet.text.encode('utf-8'):
print('Verified!') print('Verified!')
verifyByID(tweet.in_reply_to_status_id_str) verifyByID(tweet.in_reply_to_status_id_str, tweet.id_str)
def getReply(tweet): def getReply(tweet):
conn = sqlite3.connect(dbPath) conn = sqlite3.connect(dbPath)