@@ -8,6 +8,9 @@ export type Snowflake = string;
88 */
99export type Permissions = string ;
1010
11+ const timestampStyles = 'DFRSTdfst' ;
12+ const timestampLength = 13 ;
13+
1114/**
1215 * @see {@link https://discord.com/developers/docs/reference#message-formatting-formats }
1316 */
@@ -76,20 +79,19 @@ export const FormattingPatterns = {
7679 *
7780 * The `timestamp` and `style` group properties are present on the `exec` result of this expression
7881 */
79- // eslint-disable-next-line prefer-named-capture-group, unicorn/better-regex
80- Timestamp : / < t : (?< timestamp > - ? \d { 1 , 13 } ) ( : (?< style > [ D F R S T d f s t ] ) ) ? > / ,
82+ Timestamp : new RegExp ( `<t:(?<timestamp>-?\\d{1,${ timestampLength } })(:(?<style>[${ timestampStyles } ]))?>` ) ,
8183 /**
8284 * Regular expression for matching strictly default styled timestamps
8385 *
8486 * The `timestamp` group property is present on the `exec` result of this expression
8587 */
86- DefaultStyledTimestamp : / < t : (?< timestamp > - ? \d { 1 , 13 } ) > / ,
88+ DefaultStyledTimestamp : new RegExp ( ` <t:(?<timestamp>-?\\ d{1,${ timestampLength } })>` ) ,
8789 /**
8890 * Regular expression for matching strictly custom styled timestamps
8991 *
9092 * The `timestamp` and `style` group properties are present on the `exec` result of this expression
9193 */
92- StyledTimestamp : / < t : (?< timestamp > - ? \d { 1 , 13 } ) : (?< style > [ D F R T d f t ] ) > / ,
94+ StyledTimestamp : new RegExp ( ` <t:(?<timestamp>-?\\ d{1,${ timestampLength } } ):(?<style>[${ timestampStyles } ])>` ) ,
9395 /**
9496 * Regular expression for matching a guild navigation mention
9597 *
0 commit comments