- Documentation: Bot commands
#countervandalismon Libera.Chat- Mailing list (Subscribing before posting is required)
Found a bug? Please report it to our issue tracker.
Python 3.9 or later. This project uses only the Python standard library and requires no third-party dependencies.
From anywhere:
python3 /path/to/CVNBot/cvnbot --config /srv/MyBot/CVNBot.iniDuring development, from your clone of the Git repository:
python3 -m cvnbot --config /srv/MyBot/CVNBot.iniOr, after pip install .:
cvnbot --config /srv/MyBot/CVNBot.iniSee Installation for a production setup.
Run the unit tests and the linter:
toxOr, run only the unit tests:
python3 -m unittest- The
python3 -m cvnbotorpython3 -m /path/to/cvnbotcommands are handled by__main__.py, which parses the CLI arguments and then delegates toCVNBot.runinprogram.py. - The Main thread (
program.py) is whereCVNBot.run- .. starts the main IRC connection to Libera Chat.
- .. starts the RCReader thread.
- .. starts ListManager's database connection (open Lists.sqlite).
- .. listens for and responds to any IRC commands.
- The RCReader thread (
rcreader.py)- .. starts a second IRC connection for RecentChanges from wikimedia.org.
- .. listens for messages and parse them into RecentChange events, for each one:
- filter based on feed settings (CVNBot.ini).
- filter based on database queries (ListManager, such as blacklist and watchlist).
- format event using messages from Console.msgs.
- send message to feed channel on Libera Chat, via the main IRC connection.
- The Tim thread (
listmanager.py)- .. removes expired rows from the database every two hours.
Notable classes:
-
Messages: This is formulates and formats messages spoken by the bot. These are read from theConsole.msgsfile, and can be reloaded at runtime via theCVNBot msgscommand. The file is considered read-only, with changes deployed via version control outside the bot runtime.See also https://gerrit.wikimedia.org/g/labs/countervandalism/cvn-infrastructure/+/HEAD/.
-
ProjectList: The set of monitored wikis as persisted inProjects.xml.For each wiki we store namespace names, and a copy of various MediaWiki interface messages to help parse log events and automatic edit summaries from the RecentChanges stream.
This XML file is writable at runtime via the
CVNBot load,CVNBot drop,CVNBot reload, andCVNBot batchreloadcommands. -
ListManager: The CVNBot database contains usernames, page titles, and various patterns that dictate which events from the RecentChanges stream to report to the CVN channel on IRC.It is backed by the
Lists.sqlitefile.
We use the Semantic Versioning guidelines as much as possible.
Releases will be numbered in the following format: <major>.<minor>.<patch>
For more information on SemVer, please visit https://semver.org/.
See LICENSE.