Discordbot: Discord Link Preview User Agent and IPs
Discordbot fetches a page when someone shares its link in Discord, to build a preview card. Its user agent, IP list, and how to verify or block it.
Discordbot is the bot that Discord uses to build link preview cards. It visits a page only when someone shares a link to it in a Discord message. It does not crawl the web on its own. If you want previews for your pages, let Discordbot fetch them. Use Discord’s published IP list to make sure that the requests are real.
What Discordbot does
Discord describes the bot in its support article About Discord Link Previews and the Discordbot. When a user shares a link in a message, Discord visits the link. It reads the page title, description and image, and it builds the preview card from them. Discord says that there is no continuous scanning or crawling of websites.
If the link points to an image or a video, Discord can keep a copy for a period. Viewers then load the file from Discord’s servers, not from your site. Discord says that this keeps the IP address of the viewer private from the site that hosts the file.
User agent
Discord gives this user agent:
Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)
Discord says to look for the word Discordbot anywhere in the string. Other parts of the string can change over time, so do not match the full string exactly.
Verify requests
Discord says that the user agent alone is not proof, because any client can fake it. If you use the user agent to let requests through a firewall, also use the IP address. Make sure that the source IP is in Discord’s public IP ranges:
- discord.json: JSON, with a service label such as
apiormediafor each range - discord.txt: one range per line
Download the list again from time to time, because Discord can change the ranges.
Set the preview content
The support article does not name the HTML tags that Discordbot reads. Many sites set the title, description and image of link previews with Open Graph tags. See Open Graph meta tags and og:image for the syntax.
Block Discordbot
Discord’s article does not mention robots.txt. If you do not want Discord previews, block the Discordbot user agent or Discord’s IP ranges on your server. Discord then cannot read the page, so it cannot build a preview card for it. The block has no effect on search engines or AI crawlers.