Skip to content

Instantly share code, notes, and snippets.

@aronson
Last active March 8, 2020 03:13
Show Gist options
  • Save aronson/c97d60920572f9b6891fefb2ef8c5f6f to your computer and use it in GitHub Desktop.
Save aronson/c97d60920572f9b6891fefb2ef8c5f6f to your computer and use it in GitHub Desktop.
Trade safely in Mudae when some user is a bad actor

Mudae Safe Trading Process

Problem

As a user, someone starts an unexpected trade and I lose kakera or a waifu I didn't mean to trade.

A malicious trade

Alice: hey bob want miku for zero two?
Bob: sure
Alice: $marryexchange @Bob Miku Hatsune
Mudae: @Bob, type the name(s) of the character(s) you want to trade against Miku Hatsune
Charlie: $marryexchange @Bob Luigi
Mudae: @Bob, type the name(s) of the character(s) you want to trade against Luigi
Bob: Zero Two
Mudae: @Alice, Miku Hatsune vs Zero Two. Do you confirm the exchange? (y/n)
Mudae: @Charlie, Luigi vs Zero Two. Do you confirm the exchange? (y/n)
Charlie: y
Alice: y
Mudae: the exchange is over: Zero Two vs Luigi
Mudae: The exchange has been declined! (Try again)
Alice: wait huh

The technical issues

  • Any other user may start a trade before a user has confirmed which character is up for trade.
  • Trade moves quickly, and others users can start malicious trades to steal characters.

Existing solutions

  • As a moderator or admin, I use $forcedivorce or other commands to punish the bad user.
  • As a user, I read chat carefully and I run a command carefully.

Problem with existing solutions

Some smaller Discord servers are not well-moderated; no moderator can use a command after a high-profile trade.


New solution

Mudaebot uses a temporary trade list. A user may have more than one trade pending at a time.

Preventing the attack

Alice: hey bob want miku for zero two?
Bob: sure
Alice: $marryexchange @Bob Miku Hatsune
Mudae: @Bob, type the name(s) of the character(s) you want to trade against Miku Hatsune
Charlie: $marryexchange @Bob Luigi
Mudae: @Bob, type the name(s) of the character(s) you want to trade against Luigi
Bob: Zero Two
Mudae: @Bob, you have multiple trades open for Zero Two, type the name of a user to confirm the exchange:

  • Alice#0001 - Miku Hatsune vs Zero Two
  • Charlie#0001 - Luigi vs Zero Two

Bob: @Alice
Mudae: @Alice, Miku Hatsune vs Zero Two. Do you confirm the exchange? (y/n)
Charlie: y
Alice: y
Mudae: The exchange is over: Zero Two vs Miku Hatsune

No change for single trade

When there is only one trade offer the process works as normal.
Alice: $marryexchange @Bob Miku Hatsune
Mudae: @Bob, type the name(s) of the character(s) you want to trade against Miku Hatsune
Bob: Zero Two
Mudae: @Alice, Miku Hatsune vs Zero Two. Do you confirm the exchange? (y/n)
Alice: y
Mudae: The exchange is over: Zero Two vs Miku Hatsune

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment