-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.d.ts
76 lines (69 loc) · 2.19 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* @module is-discord-invite
*/
declare module 'is-discord-invite' {
interface RegexFilters {
everything?: boolean;
defaultDiscordUrls?: boolean;
otherDiscordUrls?: boolean;
disboard?: boolean;
discordMe?: boolean;
discordhome?: boolean;
}
/**
* This module checks if a given string is an invitation link to a Discord server.
*
* @param {string} message - The input string to be checked.
* @param {object} options - An options object for customizing the behavior.
* @returns {boolean} - Returns `true` if the input is a valid Discord server invitation link, `false` otherwise.
*/
export function regex(message: string, options?: RegexFilters): boolean;
interface Url {
full: string;
invitationCode: string;
fetchedCode: string;
}
interface Inviter {
id: string;
username: string;
avatar: string;
discriminator: string;
public_flags: number;
flags: number;
banner: string | null;
accent_color: string | null;
global_name: string;
avatar_decoration_data: string | null;
banner_color: string | null;
}
interface Guild {
id: string;
name: string;
splash: string;
banner: string;
description: string;
icon: string;
features: string[];
verification_level: number;
vanity_url_code: string | null;
nsfw_level: number;
nsfw: boolean;
premium_subscription_count: number;
}
interface SefinekAPIResponse {
success: boolean;
code: number;
isInvitation: boolean;
message: string;
url: Url | null;
inviter: Inviter | null;
guild: Guild | null;
}
/**
* Checks for valid Discord invitation links in a given text and fetches invitation data.
*
* @param {string} message - The input text to search for Discord invitation links.
* @returns {Promise<Object|null>} - Returns invitation data if a valid link is found, or `null` if no valid links are found.
*/
export function online(message: string): Promise<SefinekAPIResponse>;
}