HostBot is a set of Python scripts that performs repetitive tasks on and for the Wikipedia Teahouse. HostBot is run by Jonathan Morgan, and is hosted by the Wikimedia Foundation. Hostbot makes extensive use of the MediaWiki API, the wikitools Python framework and may in future draw on pywikipediabot as well, although it does not currently do so.
Information about what the Teahouse is, and how it came to be can be found here. If you're curious about the current status of the project, read up here and here, or post to Jtmorgan's talk page on Wikipedia.
These scripts maintain a database of new editors who meet the basic criteria for invitation to the Teahouse, and invites ~100 editors who meet these criteria on a daily basis. You can read more about the inclusion criteria here, and you can see a daily report of the users invited here.
teahouseInvitees.py
: Grabs the daily sample of new editors to invite.inviteCheck.py
: Checks to see whether these editors have been invited to the Teahouse already by someone other than HostBot.hostbotInvites.py
: Invites all editors from today's sample who meet the invite criteria.
These scripts use several of the standard Wikipedia database tables (enwiki.revision, enwiki.recentchanges, enwiki.user... maybe a couple others) which are available to account holders on toolserver.org.
They also make use of a custom tables created to keep track of who gets invited to the Teahouse, and whether they continue editing Wikipedia (for purposes of quantifying the impact of Teahouse participation on new editor retention).
- th_up_invitees
- Used by: all new_editor_invites scripts
+-------------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+------------------+------+-----+---------+----------------+ | id | int(11) unsigned | NO | PRI | NULL | auto_increment | | user_id | int(11) | YES | UNI | NULL | | | user_name | varbinary(200) | YES | | NULL | | | user_registration | varbinary(14) | YES | | NULL | | | user_editcount | int(11) | YES | | NULL | | | email_status | varbinary(14) | YES | | NULL | | | edit_sessions | int(11) | YES | | NULL | | | sample_group | varbinary(14) | YES | | NULL | | | sample_date | datetime | YES | | NULL | | | sample_type | varbinary(11) | YES | | NULL | | | invite_status | tinyint(1) | YES | | NULL | | | hostbot_invite | tinyint(1) | YES | | NULL | | | hostbot_personal | tinyint(1) | YES | | NULL | | | hostbot_skipped | tinyint(1) | YES | | NULL | | | user_talkpage | int(11) | YES | | NULL | | +-------------------+------------------+------+-----+---------+----------------+
These scripts generate automated metrics about Teahouse activity and posts a simple metrics report to enwp.org/WP:Teahouse/Host_lounge/Metrics. Currently set up to run on the first of every month.
Currently, each of these five scripts posts a separate section to the automated metrics page.
intro_section.py
: Posts introductory content (mostly static) to the top of the page. This script must be run before any of the others.questions_section.py
: Posts the number of questions asked this month, their response rate, etc. and compares with the previous month.profiles_section.py
: Posts the number of profiles created on the Teahouse Guests page this month, their response rate, etc. and compares with the previous month.hosts_section.py
: Posts the number of hosts who participated this month, and compares that with the previous month.pageviews_section.py
: Posts the overall pageviews to Wikipedia Teahouse (main page only). Pulls from stats.grok.se.
These scripts use several of the standard Wikipedia database tables (enwiki.revision, enwiki.recentchanges, enwiki.user... maybe a couple others) which are available to account holders on toolserver.org. Several of the automated metrics scripts also use a set of custom tables that track various activity metrics on enwp.org/WP:Teahouse.
- th_up_questions
- Used by:
questions_section.py
+--------------------+-----------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+-----------------+------+-----+---------+-------+ | rev_id | int(8) unsigned | NO | PRI | 0 | | | rev_user | int(5) unsigned | NO | | 0 | | | rev_user_text | varbinary(255) | NO | | | | | rev_timestamp | varbinary(14) | NO | | | | | rev_comment | varbinary(255) | YES | | NULL | | | post_date | datetime | YES | | NULL | | | week | int(11) | YES | | NULL | | | questioner_replies | int(11) | YES | | NULL | | | answers | int(11) | YES | | NULL | | | first_answer_date | datetime | YES | | NULL | | +--------------------+-----------------+------+-----+---------+-------+
- th_up_hosts
- Used by:
hosts_section.py
+----------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------+------+-----+---------+----------------+ | id | int(11) unsigned | NO | PRI | NULL | auto_increment | | user_name | varbinary(255) | YES | UNI | NULL | | | user_id | int(11) | YES | UNI | NULL | | | user_talkpage | int(11) | YES | | NULL | | | join_date | datetime | YES | | NULL | | | last_move_date | datetime | YES | | NULL | | | num_edits_2wk | int(11) | YES | | NULL | | | latest_edit | datetime | YES | | NULL | | | in_breakroom | tinyint(1) | YES | | NULL | | | retired | tinyint(1) | YES | | NULL | | | featured | tinyint(1) | YES | | NULL | | | colleague | tinyint(1) | YES | | NULL | | | has_profile | tinyint(1) | YES | | NULL | | +----------------+------------------+------+-----+---------+----------------+
- th_up_profiles
- Used by:
profiles_section.py
These scripts work together to make sure that the list of profiles visible to guests on the host profile page is reflective of the hosts who are currently actively participating in the Teahouse. Hosts who become inactive are moved to the host breakroom page. Currently, a host is considered inactive if they have not edited WP:Teahouse or any of its sub- or talk-pages for at least 2 weeks. Host profiles are moved back to the host landing page (which is transcluded into Teahouse/Hosts) when they become active again, or when they check in.
These scripts use the MediaWiki API.
deactivateHosts.py
: Moves profiles of inactive hosts to the breakroomreactivateHosts.py
: Moves profiles of newly active hosts to the host_landing page.reorderHosts.py
: Re-orders host profiles, putting the newest and most active hosts on top.clearCheckins.py
: clears the checkins page, if not blank.
Custom: th_up_hosts
Default: enwiki.revision
These scripts work together to make sure that the list of profiles visible to guests on the guest profile page is relatively short, and contains only the profiles of the most recent visitors. Older guest profiles are moved to the guestbook page, after which MiszaBot II takes care of archiving. Currently, guest profiles are archived weekly on en.wp.teahouse, from the two sub_pages, Left_column and Right_column, which are transcluded into Teahouse/Guests.
These scripts use the MediaWiki API.
archiveGuestsLeft.py
: Moves older guest profiles to the guestbook.archiveGuestsRight.py
: Moves moves older guest profiles to the guest book.
None
These scripts work together to push recent content to the Teahouse front page.
These scripts use the MediaWiki API.
featuredGuests.py
: Grabs relevant fields from the profiles of recent guests on Left_column and Right_column and adds them to sub-pages of the featured guest index, overwriting the previous set. For variety, only guest profiles with a custom image are selected.featuredHosts.py
: Grabs relevant fields from the profiles of recently-joined and highly-active hosts on the host_landing page and adds them to sub-pages of the featured host index, overwriting the previous set.recentQuestions.py
: Grabs up to five questions asked on the Teahouse/Questions page from the last two days and adds them to sub-pages of Teahouse/Questions-recent, overwriting the previous set.
Default: enwiki.revision