syntax fixes
This commit is contained in:
parent
f256c35d4e
commit
0ad7a41629
|
@ -10,7 +10,7 @@ type
|
|||
username*: string
|
||||
|
||||
proc `$`*(t: Tweet): string =
|
||||
return t.date.format(ISOTime) & "\t" & t.message
|
||||
return t.date.format(ISOTime) & " " & t.message
|
||||
|
||||
proc `%`*(t: Tweet): JsonNode =
|
||||
%*
|
||||
|
@ -52,7 +52,7 @@ proc getTweetsFrom*(url: string, username: string): seq[Tweet] =
|
|||
let body = url.getContent(timeout=20_000)
|
||||
|
||||
for line in body.splitLines().items():
|
||||
if line.len > 0 and line[0] != "#":
|
||||
if line.len > 0 and line[0] != '#':
|
||||
res.add(username.parseTweet(line))
|
||||
|
||||
return res
|
||||
|
@ -74,7 +74,5 @@ proc updateTweetsOnce*() {. gcsafe .} =
|
|||
for tweet in tweets.items():
|
||||
try:
|
||||
db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message)
|
||||
except:
|
||||
echo getCurrentExceptionMsg()
|
||||
except:
|
||||
echo getCurrentExceptionMsg()
|
||||
except: discard
|
||||
except: discard
|
||||
|
|
|
@ -31,6 +31,6 @@ proc updateSystemUser() =
|
|||
when isMainModule:
|
||||
while true:
|
||||
spawn updateTweetsOnce()
|
||||
updateSystemUser()
|
||||
spawn updateSystemUser()
|
||||
|
||||
sleep 300_000 # 5 minutes
|
||||
|
|
Loading…
Reference in New Issue