discord-embed-wikimedia

LAST UPDATED 2026/01/06

discord-embed-wikimedia.py 1.0.0 (2026/01/06)

Simple Discord bot that replaces the functionality of native
Wikimedia Commons embeds which have been broken since early
January 2026.

When a message contains a direct Wikimedia Commons link the bot
retrieves the image and posts it while removing the native embed
from the source message.

Native embeds appear to be broken due to Wikimedia restricting
clients that do not provide a conventional User-Agent. Photos
retrieved prior to this change are cached and unaffected.

Licensed under BSD 0-clause license, making it public domain.

USAGE

The bot only requires the discord.py package available from
pip. Set the DISCORD_TOKEN environment var and run the file.

NOTES

- Only URLs with the following scheme are recognised:
    http[s]://commons.wikimedia.org/wiki/File:
- There's a maximum of 10 images per message due to Discord
  restrictions.
- Filenames and the requesting user are listed alongside images.
- There's no error handling, raw Python errors get dumped to
  stderr.
- URLs do not require the scheme to be recognised.

CONTRIBUTING

Email patches to yarrie@yarrie.net, I cherish all correspondence.