There’s this trick going around on Discord recently where if you send any GIF from Tenor, and then type s/e/x, then it turns it into a different meme GIF. Here’s how it works.

The sed syntax link icon

For operating systems based on Unix or Linux, there’s usually a simple terminal command included called sed, which is most commonly used to run text replacement commands. Here’s a very simple example of what a basic sed command looks like:

$ sed 's/hello/goodbye/'

Discord likely implemented this in order to appeal to IRC1 users. Since IRC doesn’t support editing messages, it’s common for people to send messages in that format to tell people about changes to their previous message. Discord implemented this into both their web/desktop client and their iOS app, excluding the Android app.

Note that while real sed commands can get much more complicated, Discord’s implementation doesn’t support those advanced features2.

What does s/e/x do? link icon

When you send a GIF using the GIF picker on Discord, it actually sends the link to the GIF, which is served by Tenor. For example, here’s a GIF sent from Tenor:

Running s/e/x will take the first occurrence of e and replace it with x. The link becomes the following (notice the bolded letter x):

Then, all that’s left to do is to buy the domain, and write a simple program to run on it. In fact, it looks like that domain was purchased purely in order to make this trick possible3.

How does it display on Discord without redirecting? link icon

When viewing any of the URLs on in a normal web browser, you get redirected to a tweet. However, Discord is able to display the image without being redirected.

When Discord loads a website to generate an embed, it uses a user agent4 (which is a little piece of text which tells the server what your browser is) which looks something like this:

User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +

The important part here is the word Discord. If you visit the website with your user agent set to anything containing Discord (case-insensitive)5, then it serves the image directly.

Default image link icon

If you go to any URL on that doesn’t fit one of the existing patterns/games, then it returns this fallback image:

Fallback image on ``
Fallback image on

Extra features link icon

Double sex link icon

If you then run s/e/x a second time, then it changes to a different image:

Resulting image after typing `s/e/x` a second time.
Resulting image after typing s/e/x a second time.

This works in a simple way as well. The next e that appears in the URL is inside /view/. So, after typing s/e/x a second time, the URL becomes:

Chess (s/w/ag) link icon

Another cool feature is that you can play chess by typing s/w/ag after typing the initial message of s/e/x.

This happens once you type `s/w/ag` after having done `s/e/x`.
This happens once you type s/w/ag after having done s/e/x.

s/w/ord link icon

If you do s/w/ord after s/e/x, then it starts a fighting game (titled “Wumpagotchi Adventures”. You can use three commands: s/d/dATK, s/d/dDEF, and s/d/dHUG.

Here are a few example images:

Main s/w/ord screen link icon

This happens when you type `s/w/ord` after having done `s/e/x`.
This happens when you type s/w/ord after having done s/e/x.

ATK command link icon

This happens when you type `s/d/dATK`
This happens when you type s/d/dATK

DEF command link icon

This happens when you type `s/d/dDEF`
This happens when you type s/d/dDEF

HUG command link icon

This happens when you type `s/d/dHUG`
This happens when you type s/d/dHUG

Win screen link icon

Win screen on the `s/w/ord` game.
Win screen on the s/w/ord game.

Lose screen link icon

Lose screen on the `s/w/ord` game.
Lose screen on the s/w/ord game.

6969th Discord Sexer link icon

If you happen to get a one in 6970 chance, it will instead return a special image:

This happens on average (since it's randomized) every 6070th use.
This happens on average (since it’s randomized) every 6070th use.

Here’s a snippet of the code that handles this chance:

# 6969th winner image (disable for chess)
if random.randint(0, 6969) == 6969 and "ag" not in name:
    web.header('Cache-Control', 'no-store')
    return six_nine

I believe it’s supposed to be a 1/6969 chance, but random.randint in Python includes both numbers. That means that the possible numbers that it could pick would be 0, 1, … 6968, 6969. If you were to count the numbers included in that sequence, it would total 6970.

Math challenge link icon

Any URL that matches this regular expression will instead return a randomized math challenge. This means the URL can be followed by either math, math_challenge, or mathchallenge, a single optional slash, and then any text that’s made up of only letters, numbers, underscores or hyphens.

Math challenge example
Math challenge example

What’s special is that the math challenge is set to not be cached. That means that it should6 give everyone a different question.

How it works is that when each person’s Discord client sends a request to the Discord CDN to get the image, the client caches that image. That means each client will see the same challenge problem, even if the user restarts the client. But separate clients will not have it cached, so they’ll request it again themselves, and different numbers will be generated.

Discord sex is open source link icon

Thanks to a comment from Rebane on this post, I now know that the server running on is open source. See rebane2001/txnor-server.

YouTube video link icon

Rebane also made a YouTube video about this trick. Make sure to check it out too!

  1. IRC (Internet Relay Chat) is a simple text-based chat system. It’s a very old protocol, however its simplicity and minimalism is the main reason people choose it. It’s not very popular anymore. ↩︎

  2. Also note that in Discord’s implementation, the trailing slash (after goodbye) can be ommitted (making it just s/hello/goodbye), but with the real sed command, it’s required. ↩︎

  3. According to a quick WHOIS lookup, the domain was registered on May 3, 2022. That’s the same day that @Rebane tweeted about the new feature (going to redirects to this tweet now the domain redirects to Rebane’s YouTube video about the hack), so I assume that this is the only reason they bought the domain. ↩︎

  4. If you actually care, there’s a Wikipedia article, and a page on which also explain what a user agent is. ↩︎

  5. According to the source code, it looks like Intel Mac OS X 11.6; rv:92.0 also triggers the same response. ↩︎

  6. The caching behavior seems to be inconsistent, so sometimes it does end up giving multiple people the same question. ↩︎