For the complete documentation index, see llms.txt. This page is also available as Markdown.

👤userMention

userMention(user: string): { 
    include: boolean, 
    matchs: RegExpMatchArray | null, 
    groups: Array<{ id: string } | null> | null
}

Search user mention in a string:

const { discord } = require('regex-simplify');

const user = discord.userMention(`
    <@!584749055578603521>
    <@720256732630351912>
    <@507329636305207308>
`);

console.log(user);
{
  include: true,
  matchs: [
    '<@!584749055578603521>',
    '<@720256732630351912>',
    '<@507329636305207308>'
  ],
  groups: [
    [Object: null prototype] { id: '584749055578603521' },
    [Object: null prototype] { id: '720256732630351912' },
    [Object: null prototype] { id: '507329636305207308' }
  ]
}

Last updated