Commit Graph

82 Commits

Author SHA1 Message Date
ekzyis cc5a05574a Fix unique constraint hit
For HN reposts, the same SN dupe was found but since sn_items.id was the primary key, a unique constraint was hit.

This meant that posting the same item was attempted over and over again since the HN item id was never found in sn_items.

I manually migrated the database.
2024-04-25 18:24:27 +02:00
ekzyis 0a0470ae67 Ignore hnbot.sqlite3 2024-04-09 02:06:18 +02:00
ekzyis 822ddda1da Update to snappy v0.4.2 2024-04-07 05:49:38 +02:00
ekzyis 3d35aa5e19 Update README.md 2024-04-07 05:45:32 +02:00
ekzyis 8e28ee4691 Remove .env.template 2024-04-07 05:45:25 +02:00
ekzyis 35a4112c22 Remove discord code 2024-04-07 05:42:05 +02:00
ekzyis 24909f5d88 Delete code related to charts 2024-04-07 05:38:57 +02:00
ekzyis 3bf5c8baba Update to snappy v0.4.1 2024-04-07 05:37:31 +02:00
ekzyis ee95aa89bd Remove chart link and cron.sh
I think it was more annoying than interesting to look at.

Also, it didn't seem to be worth the maintenance of the cronjob etc.
2024-04-04 20:24:02 +02:00
ekzyis ecda7954ef Query formatting
I first thought that ORDER BY time ASC was missing because I didn't see it.
2024-03-31 16:52:59 +02:00
ekzyis 7786a7f6da Only crosspost link if still rank 1 after 1 hour 2024-03-31 03:48:52 +02:00
ekzyis 1416550be9 First wait, then run 2024-03-18 08:26:04 +01:00
ekzyis 7bf9e6c53c Remove unnecessary goroutines 2024-03-18 08:22:51 +01:00
ekzyis 0285c5a53a Sync HN items every minute 2024-03-18 08:19:46 +01:00
ekzyis a2633b1fdb Update to sn-goapi v0.3.3
This should also fix checksum mismatches for v0.3.1
2024-03-18 07:54:24 +01:00
ekzyis fc0d9d0690 Fix plots not generated until after item is posted 2024-03-18 06:43:48 +00:00
ekzyis b8188fbb2e Fix comment 2024-03-18 07:15:22 +01:00
ekzyis d116ba00bd Fix no error handling for comments 2024-03-18 07:14:43 +01:00
ekzyis a3933b48c6 Only run every 15 minutes
This should prevent spam fees.
2024-03-18 07:09:19 +01:00
ekzyis 638939edd6 Only post the oldest HN item per run 2024-03-18 07:07:13 +01:00
ekzyis bf0387ffdb go mod tidy 2024-03-17 22:12:56 +00:00
ekzyis 00d3d759ac Add link to chart
* Added SQL file to export CSV
* Updated plot.py to close figures due to RuntimeWarning shown
* hnbot now includes link to chart in comment
* charts are generated and copied to files.ekzyis.com using a cronjob
2024-03-17 21:29:33 +00:00
ekzyis c993978384 Fix checksum mismatch 2024-03-17 20:49:17 +00:00
ekzyis bf95fba2dc Fix post error: 'title: must be at least 5 characters' 2024-03-17 21:26:59 +01:00
ekzyis 45d0376889 Add plot script 2024-03-14 04:09:38 +01:00
ekzyis 9d38176eab Save dupes to prevent retries 2024-03-14 03:00:43 +01:00
ekzyis 7e4744503f Store time series of HN data in SQLite3
This can be used in the future for better content curation and generating charts.

Currently, it still posts stories when they hit rank 1.
2024-03-13 13:41:04 +01:00
ekzyis c7e368ed2e Fix slice out of bounds error
Fixes following error:

  panic: runtime error: slice bounds out of range [:80] with length 53
2023-08-31 09:56:53 +02:00
ekzyis bd4c8fb4a9 Limit title to 80 chars 2023-08-30 16:16:53 +02:00
ekzyis ef9b948f0e Upgrade to sn-goapi v0.3.1 2023-08-30 16:13:31 +02:00
ekzyis e5688d8cc4 Fix invalid URL on Ask HN posts 2023-08-15 22:23:16 +02:00
ekzyis 88e2ff8b41 Add session keepAlive 2023-08-15 22:07:39 +02:00
ekzyis 7e892859c3 Better logging 2023-06-13 00:02:14 +02:00
ekzyis 1a02fe42c1 Use tech sub 2023-06-12 23:54:15 +02:00
ekzyis c40d61a6a8 Stop sending dupes error to discord 2023-06-09 06:02:55 +02:00
ekzyis 819905740a Update README 2023-06-08 23:26:22 +02:00
ekzyis e0b086c744 Upgrade to sn-goapi v0.1.1 2023-06-01 03:41:20 +02:00
ekzyis 9e057fca03 Use sn-goapi v0.1.0 2023-06-01 03:11:36 +02:00
ekzyis aaa89408d1 Query hasNewNotes and forward 2023-06-01 01:58:08 +02:00
ekzyis 64799bfa10 Fix GraphQL error handling 2023-05-11 23:37:48 +02:00
ekzyis 6cb901728a Add new required field 'sub' 2023-05-11 22:57:52 +02:00
ekzyis 2a9b7c6737 Wait until next full hour 2023-04-27 00:55:39 +02:00
ekzyis 5388480f31 Overhaul logging and error handling 2023-04-25 12:01:49 +02:00
ekzyis 85fa5997dd Set static vars outside of init 2023-04-25 02:30:04 +02:00
ekzyis e0866c8470 Fix duplicate user struct 2023-04-25 02:26:44 +02:00
ekzyis 12143f1296 Replace ItemID with int 2023-04-25 02:25:59 +02:00
ekzyis 26aa14c9a1 Merge branch '6-show-error-if-dupes-exist-and-add-option-to-override' into 'develop'
Resolve "Show error if dupes exist and add option to override"

Closes #6

See merge request ekzyis/hnbot!5
2023-04-25 00:25:22 +00:00
ekzyis c2b6e77751 Skip dupes check on skip reaction 2023-04-25 02:22:27 +02:00
ekzyis 8eaaaeab3e Rename var DiscordClient to dg 2023-04-25 02:01:58 +02:00
ekzyis b2b957e5c3 Replace webhook with discordgo 2023-04-25 02:00:48 +02:00