Invite begone thot (Discord)

Function JavaScript 2 revisions 359 10 months ago 10 months ago
function inviteRemoval (args) {
    let re = /discord(?:app\.com\/invite|\.gg)\/([a-z0-9]{1,16})/gi;
    const match = re.exec(args);
    if (match) {
      return args.replace(match[0], '`invite`');
    } else {
      return args;

This is used in Dank Memer (https://dankmemer.lol/) to filter out invites from things like the "pls say" command, in order to prevent users from using our bot to advertise.