CVNBot

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Barras (talk | contribs) at 19:46, 19 August 2012 (might be good to have that here). It may differ significantly from the current version.

SWMTBot is a C# bot developed by Tangotango, Az1568 and Krinkle. It is designed for use in networked or multiwiki channels. Features include dynamic loading and unloading of wikis and channels, a central configuration file and database, global lists, auto-broadcast of global changes to all other SWMTBot instances, and detection of page blanking and replacement using automated MediaWiki summaries. Although the thresholds and events can be configured per-bot, per-channel event configuration is not possible.

Common SWMTBot names ran by CVN: Cubbie, CVNBot*, KrinkleBot*, rcbot, SWBot*, wbbot, WikiaRC

Lists

All global lists are automatically synchronized across all SWMTBots; per-wiki lists are not. There is a global article watchlist for all wikis, and one for each one; you can add/delete/show items on the global list by leaving out the "p=" parameter (see the command lists below for more information).

Global lists Per-wiki lists
  • Bad new usernames (BNU)
  • Bad new article titles (BNA)
  • Bad edit summaries (BES)
  • User whitelist (WL)
  • User blacklist (BL)
  • User greylist (GL)
  • Global article watchlist (CVP)
  • Lists of admins (AL)
  • Lists of bots (BOTS)
  • Article watchlists (CVP)

Details for using lists can be found below

Commands

All global lists are automatically synchronized across all SWMTBots; per-wiki lists are not. There is a global article watchlist for all wikis, and one for each one; you can add/delete/show items on the global list by leaving out the "p=" parameter (see the command lists below for more information).

SWMTBot is used as example bot name below. In reality refer to the actual bot.
Control Commands
Command Description Example
quit Quits the bot SWMTBot quit
restart Restarts the bot SWMTBot restart
list Returns a list of all currently monitored wikis SWMTBot list
load wiki.name [interwiki] Loads a wiki for monitoring SWMTBot load en.wikipedia en:
SWMTBot load meta.wikimedia m:
SWMTBot load nl.wikimedia nl:chapter:
SWMTBot load sv.wikiquote q:sv:
reload wiki.name Downloads new messages from the wiki; use if any of the log entry messages in the MediaWiki: namespace on that wiki have changed SWMTBot reload fr.wikipedia
batchreload Performs reload for all currently loaded wikis. Extremely resource-intensive and thoroughly not recommended SWMTBot batchreload
drop wiki.name Stops monitoring a wiki SWMTBot drop als.wikipedia
purge wiki.name Removes from the database all users and watchlisted items pertaining to a particular wiki SWMTBot purge als.wikipedia
msgs Re-loads messages from the Console.msgs file; necessary only when the file has changed SWMTBot msgs
bleep wiki.name Finds out which bot monitors a particular project. You can issue this command to any networked bot to receive the same results SWMTBot bleep commons.wikimedia
Info commands
count Finds out how many wikis each bot monitors, and each bot's version. You can issue this command to any networked bot to receive the same results SWMTBot count
config
settings
version
When the last message was received from the source. SWMTBot status
help Link to documentation SWMTBot help
List commands

List commands

Command Description Example
bl add/del/show username [x=duration] [r=reason] Adds, deletes, or shows an item on the global blacklist. Set x=0 to make indefinite SWMTBot bl add Tangotango x=0 r=Bad vandal (Adds Tangotango to the global blacklist indefinitely)
SWMTBot bl del Tangotango (Removes Tangotango from the global blacklist)
gl del username Deletes a user from the greylist. Use this if you want to whitelist a user, but they are on the greylist. Remove them from gl and add to wl. SWMTBot gl del Mike.lifeguard (removes Mike.lifeguard from the greylist)
wl add/del/show username [x=duration] [r=reason] Adds, deletes, or shows an item on the whitelist. Set x=0 to make indefinite (See above; wl has the same syntax as bl)
intel username Shows the item on the list (listname, adder, duration and reason) if it's listed somewhere. SWMTBot intel ZooFari (ZooFari is on commons.wikimedia admin list, added by SWMTBot until the end of time ("Auto-download from wiki"))
SWMTBot intel Krinkle (Krinkle is on global whitelist, added by ZooFari until the end of time ("trusted"))
cvp add/del/show article name [p=wiki.name] [x=duration] [r=reason] Adds, deletes, or shows an article on the watchlist. Leave out p= to monitor articles with the same name on all wikis; set x=0 to make indefinite SWMTBot cvp add United States p=en.wikipedia x=0 (Adds "United States" to the en.wikipedia watchlist)
SWMTBot cvp add Main Page x=0 (Adds all pages named "Main Page" on all wikis to the watchlist)
al add/del/show username p=wiki.name [x=duration] [r=reason] Adds, deletes, or shows an item on the admin list on a particular wiki. Set x=0 to make indefinite SWMTBot al add Tangotango p=ga.wikipedia x=0 (Adds Tangotango to the admin list on ga.wikipedia)
bots add/del/show username p=wiki.name [x=duration] [r=reason] Adds, deletes, or shows an item on the flagged-bot list on a particular wiki. Set x=0 to make indefinite (See above; bots has the same syntax as al)
bnu add/del/show regex [x=duration] [r=reason] Adds, deletes, or shows an item on the global bad new username list. Set x=0 to make indefinite SWMTBot bnu add Tangot.*?ngo x=128 r=vandal meme (Adds Tangot.*?ngo as a bad new username)
bna add/del/show regex [x=duration] [r=reason] Adds, deletes, or shows an item on the global bad new article title list. Set x=0 to make indefinite SWMTBot bna add index\.php r=vandal meme (Matches "index.php" as a bad new page title)
bes add/del/show regex [x=duration] [r=reason] Adds, deletes, or shows an item on the global bad edit summary list. Set x=0 to make indefinite SWMTBot bes add !{3,} r=Too many exclamation marks (Makes SWMTBot flag any edit summary with 3 or more exclamation marks)
getadmins wiki.name Downloads a list of admins from the specified project and automatically adds it to the SWMTBot database SWMTBot config getadmins en.wikipedia
getbots wiki.name Downloads a list of flagged bots from the specified project and automatically adds it to the SWMTBot database SWMTBot config getbots da.wiktionary
batchgetusers Performs getadmins and getbots for all currently loaded wikis SWMTBot batchgetusers
  • regex : If you do not know what regex means, don't use commands that have this keyword in their instructions. It could potentially cause of a lot of problems in the network by using it wrong, because commands that use regex can sometimes trigger an automatic greylist causing false positives to be made and thus (for example) an edit of an interwiki bot could be matched and then flooding channels.

Comparison with pgkbot

SWMTBot is a port of pgkbot to C#, specially made to suit the needs of the Small Wiki Monitoring Team and other users who monitor a large number of feeds in one channel. Most commands have been kept identical to their pgkbot equivalents except where necessary; messages have also been kept as close to pgkbot's as possible.

Features new to SWMTBot Features in pgkbot but not in SWMTBot
  • Hot-pluggable wikis (load/unload on demand)
  • Supports simultaneous monitoring of a very large number of wikis with minimal resource usage
  • One small configuration file containing information for all wikis
  • One SQLite database, using minimal resources, for all wikis
  • Global blacklists/whitelists/greylists
  • Global username/article title watchlists (supports regular expressions)
  • Global edit summary watchlist (flags potentially vandalistic edit summaries; supports regular expressions)
  • Auto-broadcast of all global lists to other SWMTBots
  • Catches page blankings/replacements (using the new autosummaries)
  • Plugins
  • A choice of database backends
  • Telnet interface
  • Complex destination/event routers
  • Individual blacklists/whitelists
  • Individual username/article title watchlists
  • Wheeler detection
  • IP categories
  • Command renaming

Installation

Stable release 1.19.0

  1. Download a copy of SWMTBot here
  2. Create a folder somewhere on your computer named BotNickname (ie. /Users/johndoe/MyRCbot)
  3. Copy all files from the zip in /SWMTBot/bin/Release to this new folder
  4. Copy Console.msgs and sqlite3.dll from the ZIP's root also to this new folder
  5. Create a plain text file in the new folder called SWMTBot.ini and copy the contents of SWMTBot-sample.ini as a base
  6. Edit SWMTBot.ini making sure at least "botnick" and "botpass" (NickServ login) are filled in properly
  7. Now start the bot by executing the command "mono SWMTBot.exe" in your Terminal when in the 'MyRCbot' folder.
  8. The bot will join the specified "feedchannel" on irc.freenode.org (by default: #cvn-sandboxconnect). Bot is ready for action.

Trunk 1.20beta

  1. SVN Checkout https://svn.toolserver.org/svnroot/p_swmtbot
  2. Create a folder somewhere on your computer named BotNickname (ie. /Users/johndoe/MyRCbot)
  3. Copy all files from the svn checkout in /SWMTBot/bin/Release to this new folder
  4. Copy SWMTBot-sample.ini and SWMTBot.exe.config from the svn checkout root also to this new folder
  5. Your MyBot-folder should now contain 10 files (verify this!): Console.msgs, Meebey.SmartIrc4net.dll, Mono.Data.SqliteClient.dll, Projects.xml, SWMTBot.exe, SWMTBot-sample.ini, SWMTBot.exe.config, SWMTBot.exe.mdb, log4net.dll and sqlite3.dll.
  6. Rename SWMTBot-sample.ini to SWMTBot.ini and edit it making sure at least "botnick" (and "botpass" if you have NickServ login) are filled in properly.
  7. If you upgraded from an earlier version:
    • You can copy the values from the old SWMTBot.ini file. However it's recommended not to replace the file with the old one. Start with -sample.ini and populate it with variables from your old ini file.
    • If your previous bot ran 1.19 or higher, copy Lists.sqlite and Projects.xml from your old bot to this bot directory (overwrite the Projects.xml that came with the download)
  8. Now start the bot by executing the command "mono SWMTBot.exe" in your Terminal when in the 'MyRCbot' folder.
  9. The bot will join the specified "feedchannel=" on irc.freenode.org (by default: #cvn-sandboxconnect). Bot is ready for action.

Configuration

botnick
Nickname the bot will use when joining feedchannel on ircserver. Also used to identify with NickServ (so it should be a nickname registered with NickServ, but it doesn't have to be the name of the NickServ account, it could be one of the grouped aliases).
botpass
Password for the NickServ account.
description
User comment as returned by /whois. The software version number is appended to this, so the usual value for this is something like or ending with "SWMTBot Version: "
partmsg
Comment used when the bot parts. It is recommended to mention a URL here to a page with more information about this bot in particular or the group it is run by (e.g. "https://meta.wikimedia.org/wiki/SWMTBot", "https://meta.wikimedia.org/wiki/CVN" or "https://wiki.example.org/wiki/Project:Countervandalism#Bots")
ircserver
Hostname of the IRC server where feedchannel is hosted.
controlchannel
A channel on ircserver. The bot joins this channel but doesn't report anything to it by default. It is used as a way for global operators to command a bot without having to know or find the feedchannel the bot it is. Make sure that this channel is secured as voice or op access here would give the user the ability to send local or global commands to any bot in this channel, even if the user is not in the feedchannel.
feedchannel
A channel on ircserver. The bot joins this channel and sends it's primary output reporting edits from the RCReader here.
messages
Relative path to Console.msgs, usually "./Console.msgs".
lists
Relative path to Lists.sqlite (file is created if it doesn't exist), usually "./Lists.sqlite".
projects
Relative path to Projects.xml (file is created if it doesn't exist), usually "./Projects.xml".
broadcastchannel
A channel on ircserver. Most installations can leave this at the magic value None which will make the bot not join anything for this. Larger installations can use this channel to synchronize the items in the database marked "global". The bot will send broadcast messages to this channel when it executes something in it's database that is "global". And it also reads broadcast messages from the broadcast channel by other bots and processes them, applying the same command to it's own database. The broadcastchannel should be very well restricted as bots read anything from this channel as a potential broadcast message (regardless of voice or op). This was done so that no accesslists have to be maintained (For example the channel could be made invite only and moderated. That way you can invite a bot to the channel to let it replicate the global database. And only give it voice when it may also send commands back to the swarm).
editblank
Threshold used to determine whether an edit is to be considered a "Large removal". An edit removing more than this number of bytes will be highlighted in the feed channel. Value should be below 0. Default is "-500".
editbig
Threshold used to determine whether an edit is to be considered a "Large edit". An edit adding more than this number of bytes will be highlighted in the feed channel. Value should be above 0. Default is "500".
newbig
Threshold used to determine whether an edit is to be considered a "Large create". A page creation with more than this number of bytes will be highlighted in the feed channel. Value should be above 0. Default is "500".
newbig
Threshold used to determine whether an edit is to be considered a "Tiny create". A page creation with less than this number of bytes will be highlighted in the feed channel. Value should be above 0. Default is "10".
restartcmd
Shell command to execute when the control command "restart" is given by an op in IRC. Usually this is "nice" (with "mono SWMTBot.exe" in restartarg), or "mono" (with "SWMTBot.exe" in restartarg).
restartarg
Shell arguments to restartcmd.

Permissions

In controlchannel, feedchannel and broadcastchannel permissions apply ("voiced" users in the channel can give list commands, "op" can give control commands, and it answers in the channel where the command was given).

Restart

restartcmd and restartarg are technically optional. But they must be used in pair. If one is defined, the other must be as well. Executed like this in C#:

                //Execute the custom command
                System.Diagnostics.Process.Start((string)mainConfig["restartcmd"], (string)mainConfig["restartarg"]);

Default if restartcmd is not defined:

                //Note: argument is not actually used, but it's there to prevent a mono bug
                System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location, "--restart");

Either way, after this command is executed, the Program calls "Exit()".

License

The SWMTBot software is licensed under the MIT License.