reddit-to-telegram 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -7
- data/lib/reddit_to_telegram/telegram/video.rb +3 -2
- data/lib/reddit_to_telegram/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ec45bcf41a275baa3ea712968010d520b4af973a78149837ebe4cbc0b4c3870
|
4
|
+
data.tar.gz: 328805f68a80798c6c9c3a26fbd00aac37560ac97d55b601df9471b0587c2a31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7184c7bddf2027cfef0bd40ddd90a044e309482b1467d1ab942114d43d4b6c4b7c03d2081a06035ba4b408d82aa19c64ba28d74d5ef98c03f58399153e61dbe3
|
7
|
+
data.tar.gz: e46c030bd186fbef1185970769d8d9263849e2b8048c043ca5b7ffa28c9a5b7d4e980fde260ee705ae2358419c7c581ebba458e620c68c3742541bc511dbdaae
|
data/README.md
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
#### Fetches hot posts from chosen subreddits and pushes them to Telegram channels.
|
6
6
|
|
7
|
-
Beware, this is remotely not production-ready
|
7
|
+
Beware, this is remotely not production-ready, you'll see lots of bugs and it may break at any time.
|
8
|
+
Be sure to check for gem updates.
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
In your `Gemfile` add:
|
@@ -18,13 +19,13 @@ Or `gem install reddit-to-telegram`, but don't forget to `require` it first then
|
|
18
19
|
## Prerequisites
|
19
20
|
- You need an AWS account to host a free SimpleDB (memory and local file storage options are available, but no way to switch for now)
|
20
21
|
- (Optionally) Create a Reddit app, which would allow more requests to reddit
|
21
|
-
- [Obtain](https://core.telegram.org/bots/tutorial#
|
22
|
+
- [Obtain](https://core.telegram.org/bots/tutorial#obtain-your-bot-token) a telegram bot token
|
22
23
|
|
23
24
|
## Installation
|
24
25
|
To run it, you'll need some env variables set.
|
25
26
|
```
|
26
27
|
RTT_AWS_ACCESS_KEY_ID= # Your AWS access key ID. Needed for AWS SimpleDB storage.
|
27
|
-
RTT_AWS_REGION= # AWS region your SimpleDB will be hosted on. Beware, it's
|
28
|
+
RTT_AWS_REGION= # AWS region your SimpleDB will be hosted on. Beware, it's not available in all regions.
|
28
29
|
RTT_AWS_SECRET_ACCESS_KEY= # Your AWS access key ID. Needed for AWS SimpleDB storage.
|
29
30
|
RTT_MAX_STORED_POSTS= # (Optional) Number of posts to store in the database to avoid duplicates, default is 25.
|
30
31
|
RTT_REDDIT_CLIENT_ID= # Reddit app credentials to access API. Might not be needed depending on setup, reddit allows some requests without authentication.
|
@@ -37,6 +38,7 @@ You can also set them dynamically:
|
|
37
38
|
```
|
38
39
|
RedditToTelegram::Vars.assign_values(
|
39
40
|
max_stored_posts:,
|
41
|
+
tmp_dir:
|
40
42
|
aws_access_key_id:,
|
41
43
|
aws_secret_access_key:,
|
42
44
|
aws_region:,
|
@@ -57,7 +59,3 @@ RedditToTelegram.post(
|
|
57
59
|
|
58
60
|
```
|
59
61
|
Use `:telegram_channel_id` without the `@`.
|
60
|
-
|
61
|
-
## TODO
|
62
|
-
- Storage options
|
63
|
-
- Error handling (maybe send them to another channel in Telegram)
|
@@ -15,10 +15,11 @@ module RedditToTelegram
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def delete_file
|
18
|
+
return unless File.exist?(temp_video_path)
|
19
|
+
|
18
20
|
f = File.open(temp_video_path, "r")
|
19
|
-
ensure
|
20
21
|
f.close unless f.nil? || f.closed?
|
21
|
-
File.delete(temp_video_path)
|
22
|
+
File.delete(temp_video_path)
|
22
23
|
end
|
23
24
|
|
24
25
|
def temp_video_path
|