Skip to content

Commit

Permalink
feat: Add isSnowflake function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayfri committed Aug 31, 2021
1 parent 8398b53 commit ec60c77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export function isOwner(id: Snowflake) {
return CommandHandler.owners?.includes(id) ?? false;
}

export function isSnowflake(value: string): value is Snowflake {
return /\d{17,19}/.test(value);
}

/**
* Returns true if the value is a TextChannel or a NewsChannel.
*
Expand Down

0 comments on commit ec60c77

Please sign in to comment.