@fluxerjs/util 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -259,6 +259,31 @@ declare function parseEmoji(emoji: string): {
259
259
  name: string;
260
260
  animated?: boolean;
261
261
  } | null;
262
+ /**
263
+ * Parse a user mention string or raw snowflake and extract the user ID.
264
+ * Supports: <@123456789012345678>, <@!123456789012345678>, or raw 17–19 digit snowflake.
265
+ * @param arg - String that may contain a user mention or raw user ID
266
+ * @returns The user ID if valid, otherwise null
267
+ * @example
268
+ * parseUserMention('<@!123456789012345678>'); // '123456789012345678'
269
+ * parseUserMention('<@123456789012345678>'); // '123456789012345678'
270
+ * parseUserMention('123456789012345678'); // '123456789012345678'
271
+ */
272
+ declare function parseUserMention(arg: string): string | null;
273
+ /**
274
+ * Parse prefix command content into command name and args.
275
+ * Returns null if content does not start with the prefix.
276
+ * @param content - Raw message content
277
+ * @param prefix - Command prefix (e.g. '!')
278
+ * @returns { command, args } or null
279
+ * @example
280
+ * parsePrefixCommand('!ping', '!'); // { command: 'ping', args: [] }
281
+ * parsePrefixCommand('!hello world', '!'); // { command: 'hello', args: ['world'] }
282
+ */
283
+ declare function parsePrefixCommand(content: string, prefix: string): {
284
+ command: string;
285
+ args: string[];
286
+ } | null;
262
287
  /**
263
288
  * Parse a role mention string (e.g. <@&123456>) and extract the role ID.
264
289
  * @param arg - String that may contain a role mention
@@ -301,4 +326,4 @@ declare function resolveTenorToImageUrl(tenorViewUrl: string): Promise<TenorMedi
301
326
 
302
327
  declare function emitDeprecationWarning(symbol: string, message: string): void;
303
328
 
304
- export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, FLUXER_EPOCH, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, PermissionFlagsMap, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parseRoleMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
329
+ export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, FLUXER_EPOCH, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, PermissionFlagsMap, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parsePrefixCommand, parseRoleMention, parseUserMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
package/dist/index.d.ts CHANGED
@@ -259,6 +259,31 @@ declare function parseEmoji(emoji: string): {
259
259
  name: string;
260
260
  animated?: boolean;
261
261
  } | null;
262
+ /**
263
+ * Parse a user mention string or raw snowflake and extract the user ID.
264
+ * Supports: <@123456789012345678>, <@!123456789012345678>, or raw 17–19 digit snowflake.
265
+ * @param arg - String that may contain a user mention or raw user ID
266
+ * @returns The user ID if valid, otherwise null
267
+ * @example
268
+ * parseUserMention('<@!123456789012345678>'); // '123456789012345678'
269
+ * parseUserMention('<@123456789012345678>'); // '123456789012345678'
270
+ * parseUserMention('123456789012345678'); // '123456789012345678'
271
+ */
272
+ declare function parseUserMention(arg: string): string | null;
273
+ /**
274
+ * Parse prefix command content into command name and args.
275
+ * Returns null if content does not start with the prefix.
276
+ * @param content - Raw message content
277
+ * @param prefix - Command prefix (e.g. '!')
278
+ * @returns { command, args } or null
279
+ * @example
280
+ * parsePrefixCommand('!ping', '!'); // { command: 'ping', args: [] }
281
+ * parsePrefixCommand('!hello world', '!'); // { command: 'hello', args: ['world'] }
282
+ */
283
+ declare function parsePrefixCommand(content: string, prefix: string): {
284
+ command: string;
285
+ args: string[];
286
+ } | null;
262
287
  /**
263
288
  * Parse a role mention string (e.g. <@&123456>) and extract the role ID.
264
289
  * @param arg - String that may contain a role mention
@@ -301,4 +326,4 @@ declare function resolveTenorToImageUrl(tenorViewUrl: string): Promise<TenorMedi
301
326
 
302
327
  declare function emitDeprecationWarning(symbol: string, message: string): void;
303
328
 
304
- export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, FLUXER_EPOCH, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, PermissionFlagsMap, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parseRoleMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };
329
+ export { ALL_PERMISSIONS_BIGINT, BitField, type BitFieldResolvable, FLUXER_EPOCH, MessageFlagsBitField, MessageFlagsBits, type MessageFlagsResolvable, type MessageFlagsString, PermissionFlags, PermissionFlagsMap, type PermissionResolvable, type PermissionString, PermissionsBitField, SnowflakeUtil, type TenorMediaResult, UserFlagsBitField, UserFlagsBits, type UserFlagsResolvable, type UserFlagsString, emitDeprecationWarning, escapeMarkdown, formatColor, formatEmoji, formatTimestamp, getUnicodeFromShortcode, parseEmoji, parsePrefixCommand, parseRoleMention, parseUserMention, resolveColor, resolvePermissionsToBitfield, resolveTenorToImageUrl, truncate };