mirror of
https://github.com/house-of-vanity/conf_bot.git
synced 2025-07-06 14:24:08 +00:00
Let's collect more data.
This commit is contained in:
11
database.py
11
database.py
@ -89,15 +89,20 @@ class DataBase:
|
||||
)
|
||||
self.execute(sql)
|
||||
|
||||
def add_relation(self, word, user_id, conf_id):
|
||||
def add_relation(self, word, user_id, conf_id, text):
|
||||
word_id = self.save_word(word)
|
||||
date = int(dt.datetime.now().strftime("%s"))
|
||||
sql2 = "INSERT OR IGNORE INTO xxx_message('text') VALUES ('%s')" % text
|
||||
self.execute(sql2)
|
||||
sql3 = "SELECT id FROM `xxx_message` WHERE text = '%s'" % text
|
||||
msg_id = self.execute(sql3)[0][0]
|
||||
sql = """INSERT OR IGNORE INTO
|
||||
relations('word_id', 'user_id', 'conf_id', 'date')
|
||||
VALUES ('%s','%s','%s','%s')""" % (
|
||||
relations('word_id', 'user_id', 'conf_id', 'msg_id', 'date')
|
||||
VALUES ('%s','%s','%s','%s', '%s')""" % (
|
||||
word_id,
|
||||
user_id,
|
||||
conf_id,
|
||||
msg_id,
|
||||
date
|
||||
)
|
||||
self.execute(sql)
|
||||
|
Reference in New Issue
Block a user