You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now the readme is more detailed about commands and how the images are fetched.
The scripts now handles errors while sending images without crashing the whole system, replies in a more unique way to private messages and the log is appended at the end of the file (previously, it erased everything when it started up - access mode to file is now "a" while it used to be "w+")
Copy file name to clipboardExpand all lines: README.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
# Corgos Telgram BOT
2
2
## Free delivery of cute corgis images
3
+
`Corgo: just a corgi but man, internet slang is weird` ~ *Oxford dictionary, probably*
3
4
4
5
### Background
5
6
I like corgis. Like, a lot. Sadly I cannot adopt one right now on in the near future, so I made the most reasonable thing a person could do:
@@ -10,36 +11,46 @@ The bot is coded in Python by using the [python-telegram-bot](https://github.com
10
11
### Usage
11
12
The bot it's pretty straightforward to use. Just start a conversation with \@corgos_bot or navigate to t.me/corgos_bot to start using it.
12
13
Usage of the commands:
13
-
**/start* will give you a brief description of the bot.
14
+
**/start* will give you a brief description of what the bot can do.
14
15
**/corgo* will send you a corgi picture.
15
16
**/goldencorgo* will tell you the tale of the Golden Corgo.
16
17
**/stats* will tell you some (mostly useless) information about the bot.
17
18
18
-
It will also reply to private messages, although not in a really smart way. I mean, it's a corgi, not a human.
19
+
Furthermore, there are 3 more *hidden* commands (as they are not listed):
20
+
**/ping* will reply **PONG**, I coded this to make sure that the bot was currently running and any user can use this.
21
+
**/stop* will stop the bot. This command can only be used by users whose id is in the *admins* settings in the config file.
22
+
**/reset* will reload the script. This command can only be used by users whose id is in the *admins* settings in the config file.
23
+
24
+
The bot will also reply to private messages, although not in a really smart way. I mean, it's a corgi, not a human.
19
25
20
26
**Video example:**
21
27
22
-

28
+

23
29
24
30
*(thanks to Reddit user u/GleamTheCube for his unwitting help. What a lovely corgi!)*
25
31
26
32
### Image sourcing
27
-
All the images are sourced from Reddit, namely from */r/corgi* and */r/babycorgis* subreddits. I do not own nor I choose any of this pictures. <br>
28
-
In order to be chosen, a post must have a minimum score, fixed in the settings file. I trust each moderator and their ability to remove any unsuitable image. <br>
29
-
The subreddits are scraped three times a week, at 2.20 AM (GMT), and every time about 250 photos are loaded (this might not be a fixed value).
33
+
All the images are sourced from Reddit, namely from */r/corgi* and */r/babycorgis* subreddits. I do not own nor I choose any of this pictures.
34
+
35
+
In order to be chosen, a post must have a minimum score, fixed in the settings file. I trust each moderator and their ability to remove any unsuitable image.
36
+
37
+
The subreddits are scraped three times a week, at 2.20 AM (GMT), and every time 300 (as set in *settings.json* file) *weekly hottest* posts are loaded.
38
+
Every post is then analyzed and any non pictures posts or posts with a low score are discarded. Lastly, the list of URL is randomized.
39
+
40
+
Every time a picture is sent the list is rotated, so it's impossible that the same picture is sent twice (or more!) in a row.
30
41
31
42
### Next features
32
43
As I write this readme, the bot has been going for almost 9 month and about 20000 pictures have been sent.
33
44
I feel that, during the multiple iterations of this script (none of those are on GitHub, I'm sorry) I implemented every aspect I liked (and needed).
34
-
However, I plan to add one command to get photos of my corgi as soon as I manage to adopt one. Did I already mention that I love corgis?
35
45
46
+
However, I plan to add one command to get photos of my corgi as soon as I manage to adopt one. Did I already mention that I love corgis?
36
47
37
48
## Installation
38
49
I provided a requirements.txt file in order to automatically install all the needed requirements. <br>
39
50
If you want to run this bot yourself on your machine, you have to follow a few steps:
40
51
1. Register to Reddit Api
41
52
2. Create a Telegram bot using \@botfather on Telegram and set the command list as it's provided in the code (line 145)
42
-
3. Create your own Golden Corgo image (yeah, I'm not going to provide it. That's top secret)
53
+
3. Create your own Golden Corgo image (yeah, I'm not going to provide it. That's top secret!)
43
54
4. Fill the *settings.json* with the data you have gathered so far (Reddit access details, Telegram token)
44
55
5. Install all the requirements via the command `pip3 install -r requirements.txt`
45
56
6. Finally, run the script with `python3 corgos_bot.py`. The script will log everything in a file (named *logging.log*) in the same folder.
0 commit comments