Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the feed_deactivated_warn is not sent to the ERROR_LOGGING_CHAT #550

Open
hellodword opened this issue Oct 10, 2024 · 3 comments
Open

the feed_deactivated_warn is not sent to the ERROR_LOGGING_CHAT #550

hellodword opened this issue Oct 10, 2024 · 3 comments

Comments

@hellodword
Copy link
Contributor

It looks like the feed_deactivated_warn message is always being sent to the user who subscribed to the feed, but if I set the ERROR_LOGGING_CHAT, I would expect that chat to receive all error messages.

lang_msg_body_map: dict[str, str] = {
lang: '\n'.join((
i18n[lang]['feed_deactivated_warn'],
(
(
reason.i18n_message(lang)
if isinstance(reason, web.WebError)
else reason
)
if reason
else ''
)
))
for lang in user_id_lang_map.values()
}
sub_count = len(subs)
feed_description = f'{feed.id}: {feed.link}'
del reason
_do_send: BatchTimeout[[db.Sub, str], None]
async with BatchTimeout[[db.Sub, str], None](
func=self._do_send,
timeout=TIMEOUT,
loop=env.loop,
on_success=self._on_subtask_deactivated,
on_canceled=self._on_subtask_canceled,
on_error=self._on_subtask_unknown_error,
on_timeout=self._on_subtask_timeout,
on_timeout_error=self._on_subtask_timeout_unknown_error,
) as _do_send:
for sub in subs:
_do_send(
sub=sub,
post=(
f'<a href="{feed.link}">{escape_html(sub.title or feed.title)}</a>\n' +
lang_msg_body_map[user_id_lang_map[sub.user_id]]
)
)
del sub, subs, feed, user_id_lang_map, lang_msg_body_map
logger.debug(f'Deactivated {sub_count} subs: {feed_description}')
async def _do_send(self, sub: db.Sub, post: Union[str, Post]) -> None:
self._stat.start()
try:
await self._send(sub, post)
finally:
self._stat.finish()
async def _send(self, sub: db.Sub, post: Union[str, Post]) -> None:
user_id = sub.user_id

@Rongronggg9
Copy link
Owner

This is intended, or else users, except for those in ERROR_LOGGING_CHAT, would never know their subscriptions had been paused (deactivated).

By design, ERROR_LOGGING_CHAT is for severe unexpected errors. These errors usually need to be fixed eventually.

However, I do plan to allow the administrators of channels or groups to redirect these deactivation messages to somewhere else.

@Rongronggg9
Copy link
Owner

However, I do plan to allow the administrators of channels or groups to redirect these deactivation messages to somewhere else.

In theory, ordinary users can also utilize such a feature. 🤔

I am super occupied these days and I have not started working on it yet. I would appreciate it if you would like to implement it.

@hellodword
Copy link
Contributor Author

This is intended, or else users, except for those in ERROR_LOGGING_CHAT, would never know their subscriptions had been paused (deactivated).

Here is my use case: I've created several channels for users and manage the bot through direct chat with it. As the admin, I just set up the feeds for the channels and fix issues when errors occur, but I don't care about the content of the feeds. Similarly, the users don’t care about the error messages or which feeds the channels are subscribed to.

I am super occupied these days and I have not started working on it yet. I would appreciate it if you would like to implement it.

I'd love to, but such a highly engineered Python project is difficult for me. I will try, but it may not succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants