Page MenuHomeMiraheze

Create feed to monitor suspicious keywords/regex (both for T&S and CVT)
Closed, ResolvedPublic

Description

As a follow up for T9540 (or even potential replacement) after discussing with @Owen it would be useful if we could have a feed on Discord and IRC which would contain edits (including text, not only edit summaries) that include certain keywords/regex. Owen mentioned that he saw that on Slack there's the possibility to have a bot that when an emoji is added it can perform certain actions. In this case, if possible with Discord that bot could generate a TSPortal report if a member of T&S adds an emoji as a reaction. Stewards/GS could add emojis to mark the feed as checked/resolved.

Event Timeline

Reception123 created this task.
Herald added subscribers: BrandonWM, OrangeStar, Unknown Object (User), Unknown Object (User). · View Herald TranscriptFeb 5 2023, 12:54

The existing IRC feed bots analyze the postings in the main #miraheze-feed channel and relay matching patterns/strings etc to the cvt feed. To be able to look at changed/added text, it would have to use the MW api.

Unknown Object (User) added a comment.Feb 5 2023, 17:04

My CVTBot supports edit summaries (not text as wanted here) with command (including Regex support) (based on #miraheze-feed), I thought about initially letting it use MW API, but it seems like it would cause excessive requests, and performance impact in addition to rate limiting. It uses the API for some things, like getting interface messages, and admin and bot lists, but using it for everything seems like it would have some impact.

I can however potentially modify my version of the DiscordNotifications extension to support something like this on Discord at least, but I can't guarantee that either.

Unknown Object (User) added a comment.EditedFeb 5 2023, 20:02

https://github.com/Universal-Omega/DiscordNotifications/pull/19 — this will allow us to basically use the PageSaveComplete hook (and other hooks for other types of checks), then the new services this introduces, and basically like this (where the embedFields uses the new DiscordEmbedBuilder service to add fields to the embed):

$discordNotifier = MediaWikiServices::getInstance()->getService( 'DiscordNotifier' );
$message = 'Text matched x';
// might need to support other actions also
$action = 'article_saved';
// this would be changed to get and truncate content to only a certain number of characters before and after the relevant match
$embedFields = [ 'summary' => $summary, 'content' => '(content)' ];
// Would be a private config, and used as the webhook for specific matches only
$webhook = 'xxxx';
$discordNotifier->notify( $message, $user, $action, $embedFields, $webhook );

Of course that is just a proof of concept, nothing working yet, but the patch works to maintain current functionality also (already tested), though it might be kinda messy implementation here, we can probably add a new DiscordMatchNotifierHooks.php file (or something similar, maybe not exact name) in MirahezeMagic for the hooks to notify to Discord.

Unknown Object (User) added a comment.Feb 6 2023, 02:28

https://github.com/Universal-Omega/DiscordNotifications/pull/19 — this will allow us to basically use the PageSaveComplete hook (and other hooks for other types of checks), then the new services this introduces, and basically like this (where the embedFields uses the new DiscordEmbedBuilder service to add fields to the embed):

$discordNotifier = MediaWikiServices::getInstance()->getService( 'DiscordNotifier' );
$message = 'Text matched x';
// might need to support other actions also
$action = 'article_saved';
// this would be changed to get and truncate content to only a certain number of characters before and after the relevant match
$embedFields = [ 'summary' => $summary, 'content' => '(content)' ];
// Would be a private config, and used as the webhook for specific matches only
$webhook = 'xxxx';
$discordNotifier->notify( $message, $user, $action, $embedFields, $webhook );

Of course that is just a proof of concept, nothing working yet, but the patch works to maintain current functionality also (already tested), though it might be kinda messy implementation here, we can probably add a new DiscordMatchNotifierHooks.php file (or something similar, maybe not exact name) in MirahezeMagic for the hooks to notify to Discord.

I have now updated that patch, it is now possible with it, right through DiscordNotifications with configuration variables set (nothing in MirahezeMagic is necessary).

Unknown Object (User) claimed this task.Feb 9 2023, 19:48
Unknown Object (User) moved this task from Unsorted to Goals on the Universal Omega board.Feb 9 2023, 19:48
Unknown Object (User) closed this task as Resolved.Mar 18 2023, 03:38