โ ๏ธ This branch is maintained specifically for Yugipedia. MediaWiki 1.31 went End-of-Life in September 2021, but it's where we're currently stuck. This fork allows us to backport important fixes and the occasional new feature. If you maintain a wiki that is for some reason also stuck on MW 1.31, you're welcome to use this fork, but we have no intentions of supporting any other versions of MediaWiki here.
MediaWiki extension for sending notifications to a Discord webhook from MediaWiki. When a certain event occurs on your MediaWiki wiki, including new edits, they can be sent as a message to a channel on a Discord server using a webhook.
Multiple webhook URLs are supported and messages will be sent to all of them.
Live demo: https://runescape.wiki (https://discord.gg/runescapewiki)
- Discord webhook URL: This can be obtained by editing a channel on a server with the correct permissions.
- MediaWiki 1.31+
- cURL: By default, this extension sends requests using cURL. If you don't have cURL, you could try setting
$wgDiscordUseFileGetContents
totrue
instead, but this is not recommended.
- Clone this repository to your MediaWiki installation's
extensions
folder usinggit clone https://github.com/jaydenkieran/mw-discord.git Discord
- Modify your
LocalSettings.php
file and add:
// Load the extension
wfLoadExtension( 'Discord' );
// Set the webhook URL(s) (string or array)
$wgDiscordWebhookURL = [ '' ];
For further configuration variables, see below.
To get a webhook URL for use with this extension, open the Discord client and go to a server where you have the Manage Webhooks
permission. Click the cog icon when hovering over a text channel, switch to the Webhooks tab on the left of the interface, and click 'Create webhook'. The webhook URL can then be copied from that interface.
This extension can be configured using the LocalSettings.php
file in your MediaWiki installation.
Variable | Type | Description |
---|---|---|
$wgDiscordWebhookURL |
string/array | Discord webhook URLs |
Variable | Type | Description | Default |
---|---|---|---|
$wgDiscordNoBots |
bool | Do not send notifications that are triggered by a bot account | true |
$wgDiscordNoMinor |
bool | Do not send notifications that are for minor edits | false |
$wgDiscordNoNull |
bool | Do not send notifications for null edits | true |
$wgDiscordSuppressPreviews |
bool | Force previews for links in Discord messages to be suppressed | true |
$wgDiscordMaxChars |
int | Maximum amount of characters for user-generated text (e.g summaries, reasons). Set to null to disable truncation |
null |
$wgDiscordMaxCharsUsernames |
int | Maximum amount of characters for usernames. Set to null to disable truncation |
25 |
$wgDiscordDisabledHooks |
array | List of hooks to disable sending webhooks for (see below) | [] |
$wgDiscordDisabledNS |
array | List of namespaces to disable sending webhooks for | [] |
$wgDiscordDisabledUsers |
array | List of users whose performed actions shouldn't send webhooks | [] |
$wgDiscordPrependTimestamp |
bool | Prepend a timestamp (in UTC) to all sent messages. The format can be changed by editing the MediaWiki message discord-timestampformat |
false |
$wgDiscordUseFileGetContents |
bool | Use file_get_contents instead of cURL. Requires allow_url_fopen to be set to true in php.ini . Not recommended as cURL makes simultaneous calls instead. |
false |
$wgDiscordUseEmojis |
bool | Prepend emojis to different types of messages to help distinguish them | false |
$wgDiscordEmojis |
array | Map of hook names and their associated emojis to prepend to messages if $wgDiscordUseEmojis is enabled |
See extension.json |
PageContentSaveComplete
- New edits to pages and page creationsArticleDeleteComplete
- Page deletionsArticleUndelete
- Page restorationsArticleRevisionVisibilitySet
- Revision visibility changesArticleProtectComplete
- Page protectionsTitleMoveComplete
- Page movesLocalUserCreated
- User registrationsBlockIpComplete
- User blockedUnblockUserComplete
- User unblockedUserGroupsChanged
- User rights changedUploadComplete
- File was uploadedFileDeleteComplete
- File revision was deletedFileUndeleteComplete
- File revision was restoredAfterImportPage
- Page was importedArticleMergeComplete
- Article histories was merged
ApprovedRevsRevisionApproved
- Revision was approvedApprovedRevsRevisionUnapproved
- Revision was unapprovedApprovedRevsFileRevisionApproved
- File revision was approvedApprovedRevsFileRevisionUnapproved
- File revision was unapproved
This extension can be translated through the messages in the รฌ18n
folder if you're a developer. As a wiki administrator, you may find it a better option to edit the messages on-site in the MediaWiki namespace.
Any excess whitespace in text that is translated will be stripped (e.g double spaces, etc).
This extension is licensed under the MIT License, see here for more information. This project is originally inspired by Szmyk's mediawiki-discord project, but has been rewritten completely to be more suitable for my needs.