Skip to content

Commit 07b422f

Browse files
--> v.1.0 (#3)
* Squashed commit of the following: commit 64730b8d3d31acc3b8596a609fc3b029c3680644 Author: why-not-try-calmer <[email protected]> Date: Fri Jan 7 12:30:59 2022 +0100 --- commit e658171 Author: why-not-try-calmer <[email protected]> Date: Fri Jan 7 01:19:17 2022 +0100 - implemented link-to-channel commit 5d69fca Merge: 381d27d 1ea0b81 Author: why-not-try-calmer <[email protected]> Date: Thu Jan 6 22:32:52 2022 +0100 Merge branch 'master' into dev commit 381d27d Author: why-not-try-calmer <[email protected]> Date: Thu Jan 6 20:42:40 2022 +0100 - message deletion now postprocessing commit 71df3b0 Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 21:00:47 2022 +0100 --- commit 6bbfd71 Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 21:00:25 2022 +0100 --- commit 8037393 Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 15:19:15 2022 +0100 - message auto-deletion - misssing line break in /start output commit a74102e Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 14:34:31 2022 +0100 --- commit b83238a Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 11:02:58 2022 +0100 --- commit f8f5876 Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 11:00:24 2022 +0100 --- commit 1b7413e Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 02:42:41 2022 +0100 --- commit 278f71b Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 02:42:25 2022 +0100 - better times commit 6194e2d Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 02:26:55 2022 +0100 - improved time computation commit 6e38404 Author: why-not-try-calmer <[email protected]> Date: Wed Jan 5 01:01:10 2022 +0100 - fixed wrongly placed update instruction commit dff8b38 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 21:34:16 2022 +0100 --- commit cf29a7e Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 21:14:45 2022 +0100 - fixed bot was not discard replies commit d5f1292 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 16:13:07 2022 +0100 simplifed code commit ae1ba13 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 17:31:47 2022 +0100 --- commit 4fc2e28 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 15:48:48 2022 +0100 --- commit f06a761 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 15:43:52 2022 +0100 --- commit 1a1148d Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 13:59:48 2022 +0100 - cleaned up interface commit 3793f25 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 11:26:02 2022 +0100 added filters on first batch commit fb4f9af Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 10:01:29 2022 +0100 --- commit 7efea67 Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 09:52:35 2022 +0100 --- commit c8e9b9f Author: why-not-try-calmer <[email protected]> Date: Tue Jan 4 09:46:32 2022 +0100 --- commit 6dae0ca Author: why-not-try-calmer <[email protected]> Date: Mon Jan 3 21:57:35 2022 +0100 --- commit 63c771d Author: why-not-try-calmer <[email protected]> Date: Mon Jan 3 20:09:37 2022 +0100 --- commit 55b1d35 Author: why-not-try-calmer <[email protected]> Date: Mon Jan 3 18:33:14 2022 +0100 --- commit 78d7a81 Author: why-not-try-calmer <[email protected]> Date: Mon Jan 3 17:44:02 2022 +0100 --- commit f0778b7 Author: why-not-try-calmer <[email protected]> Date: Mon Jan 3 17:15:20 2022 +0100 --- commit e0ecec1 Author: why-not-try-calmer <[email protected]> Date: Mon Jan 3 16:14:15 2022 +0100 refactored reusing pipe * --- * now postProcJobs worker is concurrent * - concurrent postprocessing * --- * - fixed truncated post titles from reddit * - new command: /link_channel, /l, taking an 64bit signed integer as unique argument, representing the channel to link - new command: /channel_settings, taking a string formatted just like the string that is the argument of /settings. - post-processing queue now threadsafe & concurrent - fixed some entities in feed items titles that were not escaped appropriately * --- * --- * --- * --- * --- * JobLogs * - commands * --- * --- * --- * --- * --- * --- * --- * --- * --- * ---
1 parent 89ac197 commit 07b422f

File tree

16 files changed

+648
-346
lines changed

16 files changed

+648
-346
lines changed

COMMANDS.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
## Commands
2+
3+
### Subscribe a channel, 1-1 chat, private group, or public group to a web feed
4+
5+
__Any chat but a channel__:
6+
7+
_The user issuing the command must have administrative rights in the chat._
8+
9+
```
10+
command | argument
11+
---------+---------------------------------------------
12+
/sub | <list of comma-separated full url addresses>
13+
---------+---------------------------------------------
14+
example | /sub https://www.reddit.com/r/pop_os.rss
15+
---------+---------------------------------------------
16+
response | error or success message
17+
---------+---------------------------------------------
18+
```
19+
20+
__Channel__:
21+
22+
_Both the user performing this command and the bot must be admin in the target channel. The command may be issued from any chat with the bot. For a better experience it is recommended to give bot the permission to edit and pin messages._
23+
24+
```
25+
command | argument
26+
---------+-------------------------------------------------------
27+
/subchan | <chat_id>
28+
---------+-------------------------------------------------------
29+
example | /subchan -25154554 https://www.reddit.com/r/pop_os.rss
30+
---------+-------------------------------------------------------
31+
response | error or success message
32+
---------+-------------------------------------------------------
33+
```
34+
35+
### View or edit a chat's or channel's settings
36+
37+
Available values:
38+
39+
- `blacklist: term, term, ...`
40+
- excludes feed items where a term is found in either their url or description
41+
- example: `blacklist: itsmycode, butIamproudofit`
42+
- `batch_at: HHMM, HHMM, ...`
43+
- incompatible with "batch_every"
44+
- batch all updates and post them at the given times
45+
- example: `batch_at: 0800, 1200, 1800`
46+
- `batch_every: n`
47+
- incompatible with "batch_at"
48+
- batch all updates and post them every n seconds
49+
- example: `batch_every: 9000` (= 20 minutes)
50+
- `paused: "true" or "false"`
51+
- suspend all notifications to the chat
52+
- `webview: "true" or "false"`
53+
- allow Telegram to display the last shown items in webview mode
54+
- `pin: "true" or "false"`,
55+
- have the bot try to pin every batch message
56+
- `clean_behind: "true" or "false"`
57+
- have the bot try to delete their own messages
58+
- does not apply to batch messages
59+
60+
_The user issuing the command must have administrative rights in the chat._
61+
62+
__Any chat but a channel__:
63+
64+
```
65+
command | argument
66+
---------+------------------------------------------
67+
/set | optional argument after line break
68+
| <":"-separated key-value pairs>
69+
---------+------------------------------------------
70+
example | /set
71+
| batch_size: 10
72+
| batch_at: 0800, 1200
73+
| webview: true >
74+
---------+------------------------------------------
75+
response | with no argument: list of settings
76+
| with argument: error or success message
77+
---------+------------------------------------------
78+
```
79+
__Channels__:
80+
81+
_Both the user performing this command and the bot must be admin in the target channel. The command may be issued from any chat with the bot. For a better experience it is recommended to give bot the permission to edit and pin messages._
82+
83+
```
84+
command | argument
85+
---------+---------------------------------------------
86+
/setchan | <line break + ":"-separated key-value pairs
87+
---------+--------------+------------------------------
88+
example | /setchan -25154554
89+
| batch_every: 9000
90+
| pin: true
91+
| webview: true
92+
---------+---------------------------------------------
93+
returns | error or success message
94+
---------+---------------------------------------------
95+
```
96+
97+
### List subscribed to web feeds
98+
99+
__Any chat but a channel__:
100+
101+
```
102+
command | argument
103+
----------+---------
104+
/list, /l | none
105+
----------+---------
106+
example | /l
107+
----------+-----------------------------
108+
response | list of #s associated with
109+
| each subscripbed to web feed
110+
----------------------------------------
111+
```
112+
113+
__Channels__:
114+
115+
```
116+
command | argument
117+
----------+---------------------------------
118+
/listchan, /lchan | <chat_id of the channel>
119+
----------+---------------------------------
120+
example | /lchan -25154554
121+
----------+---------------------------------
122+
response | list of #s associated with
123+
| each subscripbed to web feed
124+
--------------------------------------------
125+
```
126+
127+
### Show information about a subscribed to feed
128+
129+
```
130+
command | argument
131+
-------------+------------------------------------------------
132+
/feed, /f | <# of the target feed, or full url >
133+
-------------+------------------------------------------------
134+
example | /feed 1, /feed https://www.phoronix.com/rss.php
135+
-------------+------------------------------------------------
136+
response | information about the target feed
137+
-------------+------------------------------------------------
138+
```
139+
### Fetching fresh items
140+
141+
```
142+
command | argument
143+
---------+----------------------------------------------------------
144+
/fresh | <# of days representing how old the items can be at most
145+
---------+----------------------------------------------------------
146+
example | /fresh 1
147+
---------+----------------------------------------------------------
148+
response | all at most #-old items collected from
149+
| all feeds the chat is subscribed to
150+
--------------------------------------------------------------------
151+
```
152+
153+
### Displaying items from a single feed
154+
155+
```
156+
command | argument
157+
------------+--------------------------------------------
158+
/items, /i | <# or full url of the target of days
159+
| representing the max "age" of the items
160+
------------+--------------------------------------------
161+
example | /items 1
162+
| /i https://www.phoronix.com/rss.php
163+
------------+---------------------------------------------
164+
response | all the items available from the target feed
165+
----------------------------------------------------------
166+
```
167+
### Miscellaneous
168+
169+
- /pause, /p: Suspend notification to the chat
170+
- /pausechan `<chat_id>`: Like the previous one but for channels
171+
- /resume: Whether the bot is allowed to send notification messages to the chat.
172+
- /resumechan `<chat_id>`: like the previous one but for channels
173+
- /purge (chat admins only): Make the database forget entirely about the chat
174+
- /purgechan `<chat_id>` (chat admins only): Make the database forget entirely about the channel
175+
- /reset (chat admins only): Set the chat's settings to the defaults
176+
- /resetchan `<chat_id>` (chat admins only) `<channel_id>`: Set the channels's settings to the defaults
177+
- /search, /se `<space-separated keywords>`: Search for keywords in all items in all feeds the current chat is subscribed to.
178+
- example: `/se cheap cloud host`
179+
- /unsub (chat admins only) `<list of 1-space-separated #s or full url addresses>`
180+
- unsubscribe from all the feeds passed as argument, if indeed they exits
181+
- examples: `/u 1 2 3`, `/unsub https://www.compositional.fm/rss https://www.blabla.org/feed`
182+
- /unsubchan `<chat_id>` (chat admins only) `<channel id> + <list of 1-space-separated # or full urls>`: like the previous one but for channels

ChangeLog.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# feedfarer
2-
A fast, efficient network app for subscribing Telegram chats to web feeds.
2+
A fast, efficient network app for subscribing Telegram chats to web feeds, using 0 "Telegram SDK-style" framework or dependency.
33

44
## What this package provides
55
- a Telegram bot able to post updates to any web feed (Atom or RSS) feed a chat is subscribed to; the bot is also replies directly to commands for consuming feeds at one's favorite pace
@@ -23,6 +23,8 @@ All chats types are supported:
2323

2424
The bot does not require any permission; it just need to be a member of the group to which it posts updates.
2525

26+
For the exhaustive list of commands, see this [document](https://github.com/why-not-try-calmer/feedfarer2/blob/dev/COMMANDS.md).
27+
2628
__Getting started__:
2729

2830
1. Start a chat with the bot (1-1 chat) or invite it to any chat (group or private). The bot listens only to messages using commands defined for it.
@@ -115,4 +117,7 @@ STARTING_FEEDS=https://blog.system76.com/rss,https://www.reddit.com/r/pop_os.rss
115117
TELEGRAM_TOKEN=1202309djkj@@kskdjkcjkjxkj
116118
WEBHOOK_URL=https://mydomain.org/path/to/wehbook
117119
118-
```
120+
```
121+
122+
## Support this bot
123+
I am hosting the bot on my own. If you want to [pay me a coffee or a beer](https://paypal.me/WhyNotTryCalmer) to show your appreciation, that will help me maintain the code and pay the electricity bills...

app/.github/workflows/deploy.yaml

Lines changed: 0 additions & 48 deletions
This file was deleted.

feedfarer.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ license-file: LICENSE
1717
build-type: Simple
1818
extra-source-files:
1919
README.md
20-
ChangeLog.md
2120

2221
source-repository head
2322
type: git

package.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ copyright: "2021 Adrien Glauser"
88

99
extra-source-files:
1010
- README.md
11-
- ChangeLog.md
1211

1312
description: Please see the README on GitHub at <https://github.com/githubuser/feedfarer#readme>
1413

src/AppServer.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Database (getFreshPipe, initMongoCredsFrom)
1414
import Jobs
1515
import Network.Wai
1616
import Network.Wai.Handler.Warp
17-
import Requests (replyThenClean)
17+
import Requests (reply)
1818
import Responses
1919
import Servant
2020
import System.Environment (getEnvironment)
@@ -39,7 +39,7 @@ server = root :<|> handleWebhook where
3939
else liftIO $ putStrLn "Secrets do not match."
4040
where
4141
tok = bot_token . tg_config
42-
finishWith env cid err = replyThenClean (tok env) cid (PlainReply $ renderUserError err) (postjobs env)
42+
finishWith env cid err = reply (tok env) cid (ServiceReply $ renderUserError err) (postjobs env)
4343
handle upd env = case message upd of
4444
Nothing -> liftIO $ putStrLn "Failed to parse message"
4545
Just msg ->
@@ -53,7 +53,7 @@ server = root :<|> handleWebhook where
5353
Left err -> finishWith env cid err
5454
Right action -> evalTgAct uid action cid >>= \case
5555
Left err -> finishWith env cid err
56-
Right r -> replyThenClean (tok env) cid r (postjobs env)
56+
Right r -> reply (tok env) cid r (postjobs env)
5757

5858
root :: MonadIO m => App m ServerResponse
5959
root = pure $ RespOk "ok" "testing"

0 commit comments

Comments
 (0)