add debugging and remove timestamp edit temporarily
This commit is contained in:
parent
8f660d990f
commit
bdd39960d2
1 changed files with 10 additions and 4 deletions
|
@ -90,10 +90,13 @@ class ChannelMonitor(threading.Thread):
|
||||||
|
|
||||||
def send_message(self, roomid, msg):
|
def send_message(self, roomid, msg):
|
||||||
url = self.matrix_api_url + '/rooms/' + roomid +'/send/m.room.message' + '/' + str(self.txId)
|
url = self.matrix_api_url + '/rooms/' + roomid +'/send/m.room.message' + '/' + str(self.txId)
|
||||||
|
#logging.debug('debug: ' + msg['ts'])
|
||||||
|
#logging.debug('debug: ')
|
||||||
|
#logging.debug(msg['ts'])
|
||||||
|
# 'ts': msg['ts']
|
||||||
params = {
|
params = {
|
||||||
'access_token': self.matrix_api_token,
|
'access_token': self.matrix_api_token,
|
||||||
'user_id': msg['user']['user_id'],
|
'user_id': msg['user']['user_id']
|
||||||
'ts': msg['ts']
|
|
||||||
}
|
}
|
||||||
data = {
|
data = {
|
||||||
'msgtype': 'm.text',
|
'msgtype': 'm.text',
|
||||||
|
@ -106,6 +109,9 @@ class ChannelMonitor(threading.Thread):
|
||||||
el = MatrixMsgEvents(eventid, roomid, msg['msgid'], msg['puser'], msg['chan'])
|
el = MatrixMsgEvents(eventid, roomid, msg['msgid'], msg['puser'], msg['chan'])
|
||||||
db.session.add(el)
|
db.session.add(el)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
else:
|
||||||
|
logging.debug('error: ' + str(r.status_code))
|
||||||
|
logging.debug(r.text)
|
||||||
|
|
||||||
def poll_channel(self, room):
|
def poll_channel(self, room):
|
||||||
|
|
||||||
|
@ -134,7 +140,7 @@ class ChannelMonitor(threading.Thread):
|
||||||
text = msg.content.text + "\n"
|
text = msg.content.text + "\n"
|
||||||
# dt = datetime.datetime.strptime(msg.created_at, "%Y-%m-%dT%H:%M:%SZ")
|
# dt = datetime.datetime.strptime(msg.created_at, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
dt = msg.created_at
|
dt = msg.created_at
|
||||||
ts = time.mktime(dt.timetuple())
|
ts = int(time.mktime(dt.timetuple()))
|
||||||
|
|
||||||
for lnk in msg.content.entities.links:
|
for lnk in msg.content.entities.links:
|
||||||
text += "\n"
|
text += "\n"
|
||||||
|
@ -193,7 +199,7 @@ if __name__ == '__main__':
|
||||||
with open("config.yaml", "rb") as config_file:
|
with open("config.yaml", "rb") as config_file:
|
||||||
config = yaml.load(config_file)
|
config = yaml.load(config_file)
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
app.config.update(config)
|
app.config.update(config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue