stjohann / DiscordWikiBot

Discord bot for Wikimedia projects and MediaWiki wiki sites
https://w.wiki/4nm
MIT License
40 stars 10 forks source link

Translatewiki: Move the config to channel overrides #14

Open stjohann opened 2 years ago

stjohann commented 2 years ago

While Translatewiki module currently already sets channel overrides (for translatewiki-key data), it also uses server configs for everything else, which duplicates the data. This is more of a legacy thing than a conscious decision, since it makes no real difference if a server would track multiple Translatewiki languages or not. This change would enable the servers to do it as a side-effect, or even just posting the same language into multiple channels on one server (which would make testing the case where multiple servers track the same language easier).

What I want to do with this is to bring Translatewiki module closer to EventStreams/Linking modules:

  1. move all config into channel overrides (but in config.json in this case, not translatewiki.json like with eventStreams.json);
  2. rename !guildTW command to !trackTranslatewiki or similar (I generally wish to move away from !guildX to !serverX names, and this would not make sense if you could add multiple languages to one server);
  3. add code converting the old syntax to the new syntax, like one that already exists in Translatewiki.cs, so the old data does not get lost;
  4. eventually remove that code after some time.

Edit: One concern though is that it will be harder to figure out which channels require Translatewiki streaming in this setup. So when implementing this one should be careful about not, say, for-looping the channel list. It is easier for Linking to have overrides in comparison because it reacts to events in channels.

The removal of the conversion code for the data will introduce a new major version (v.N.0.0) of the bot.