✨ updated other models
This commit is contained in:
parent
b601263099
commit
1f7ebe256e
91
src/index.ts
91
src/index.ts
@ -3,14 +3,50 @@ import Config, { DefaultOptions } from "./util/Config";
|
|||||||
import db from "./util/Database";
|
import db from "./util/Database";
|
||||||
|
|
||||||
import * as Constants from "./util/Constants";
|
import * as Constants from "./util/Constants";
|
||||||
import { Channel } from "./models/Channel";
|
import {
|
||||||
|
Channel,
|
||||||
|
ChannelType,
|
||||||
|
DMChannel,
|
||||||
|
GuildChannel,
|
||||||
|
ReadState,
|
||||||
|
TextBasedChannel,
|
||||||
|
TextChannel,
|
||||||
|
VoiceChannel,
|
||||||
|
} from "./models/Channel";
|
||||||
import { Emoji } from "./models/Emoji";
|
import { Emoji } from "./models/Emoji";
|
||||||
import { Guild } from "./models/Guild";
|
import { Guild } from "./models/Guild";
|
||||||
import { Event } from "./models/Event";
|
|
||||||
import { Invite } from "./models/Invite";
|
import { Invite } from "./models/Invite";
|
||||||
import { Member } from "./models/Member";
|
import { Member, MuteConfig, PublicMember, UserGuildSettings } from "./models/Member";
|
||||||
import { Role } from "./models/Role";
|
import { Role } from "./models/Role";
|
||||||
import { User } from "./models/User";
|
import { User, ConnectedAccount, PublicUser, Relationship, UserSettings } from "./models/User";
|
||||||
|
import { Activity, ActivityType, Presence } from "./models/Activity";
|
||||||
|
import {
|
||||||
|
ApplicationCommand,
|
||||||
|
ApplicationCommandInteractionData,
|
||||||
|
ApplicationCommandInteractionDataOption,
|
||||||
|
ApplicationCommandOption,
|
||||||
|
ApplicationCommandOptionChoice,
|
||||||
|
ApplicationCommandOptionType,
|
||||||
|
} from "./models/Application";
|
||||||
|
import { ApplicationCommandPayload, EVENT, Event, MessagePayload } from "./models/Event";
|
||||||
|
import {
|
||||||
|
Interaction,
|
||||||
|
InteractionApplicationCommandCallbackData,
|
||||||
|
InteractionResponseType,
|
||||||
|
InteractionType,
|
||||||
|
} from "./models/Interaction";
|
||||||
|
import {
|
||||||
|
AllowedMentions,
|
||||||
|
Attachment,
|
||||||
|
Embed,
|
||||||
|
EmbedImage,
|
||||||
|
Message,
|
||||||
|
MessageType,
|
||||||
|
PartialEmoji,
|
||||||
|
Reaction,
|
||||||
|
} from "./models/Message";
|
||||||
|
import { ClientStatus, Status } from "./models/Status";
|
||||||
|
import { VoiceState } from "./models/VoiceState";
|
||||||
|
|
||||||
import { trimSpecial } from "./util/String";
|
import { trimSpecial } from "./util/String";
|
||||||
import { BitField } from "./util/BitField";
|
import { BitField } from "./util/BitField";
|
||||||
@ -26,19 +62,60 @@ export {
|
|||||||
Config,
|
Config,
|
||||||
Constants,
|
Constants,
|
||||||
db,
|
db,
|
||||||
|
Activity,
|
||||||
|
ActivityType,
|
||||||
|
Presence,
|
||||||
BitField,
|
BitField,
|
||||||
DefaultOptions,
|
DefaultOptions,
|
||||||
Permissions,
|
Permissions,
|
||||||
MessageFlags,
|
VoiceState,
|
||||||
UserFlags,
|
|
||||||
Snowflake,
|
Snowflake,
|
||||||
Intents,
|
Intents,
|
||||||
Channel,
|
Channel,
|
||||||
Event,
|
ChannelType,
|
||||||
|
DMChannel,
|
||||||
|
GuildChannel,
|
||||||
|
ReadState,
|
||||||
|
TextBasedChannel,
|
||||||
|
TextChannel,
|
||||||
|
VoiceChannel,
|
||||||
Emoji,
|
Emoji,
|
||||||
Guild,
|
Guild,
|
||||||
Invite,
|
Invite,
|
||||||
Member,
|
Member,
|
||||||
|
ClientStatus,
|
||||||
|
Status,
|
||||||
|
MuteConfig,
|
||||||
|
PublicMember,
|
||||||
|
UserGuildSettings,
|
||||||
Role,
|
Role,
|
||||||
User,
|
User,
|
||||||
|
UserFlags,
|
||||||
|
UserSettings,
|
||||||
|
ConnectedAccount,
|
||||||
|
PublicUser,
|
||||||
|
Relationship,
|
||||||
|
EVENT,
|
||||||
|
Event,
|
||||||
|
MessageType,
|
||||||
|
Message,
|
||||||
|
MessageFlags,
|
||||||
|
MessagePayload,
|
||||||
|
AllowedMentions,
|
||||||
|
Attachment,
|
||||||
|
Embed,
|
||||||
|
EmbedImage,
|
||||||
|
PartialEmoji,
|
||||||
|
Reaction,
|
||||||
|
Interaction,
|
||||||
|
InteractionApplicationCommandCallbackData,
|
||||||
|
InteractionResponseType,
|
||||||
|
InteractionType,
|
||||||
|
ApplicationCommand,
|
||||||
|
ApplicationCommandPayload,
|
||||||
|
ApplicationCommandInteractionData,
|
||||||
|
ApplicationCommandInteractionDataOption,
|
||||||
|
ApplicationCommandOption,
|
||||||
|
ApplicationCommandOptionChoice,
|
||||||
|
ApplicationCommandOptionType,
|
||||||
};
|
};
|
||||||
|
54
src/models/Activity.ts
Normal file
54
src/models/Activity.ts
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import { User } from "..";
|
||||||
|
import { ClientStatus, Status } from "./Status";
|
||||||
|
|
||||||
|
export interface Presence {
|
||||||
|
user: User;
|
||||||
|
guild_id: bigint;
|
||||||
|
status: Status;
|
||||||
|
activities: Activity[];
|
||||||
|
client_status: ClientStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Activity {
|
||||||
|
name: string;
|
||||||
|
type: ActivityType;
|
||||||
|
url?: string;
|
||||||
|
created_at: number;
|
||||||
|
timestamps?: {
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
}[];
|
||||||
|
application_id?: bigint;
|
||||||
|
details?: string;
|
||||||
|
state?: string;
|
||||||
|
emoji?: {
|
||||||
|
name: string;
|
||||||
|
id?: bigint;
|
||||||
|
amimated?: boolean;
|
||||||
|
};
|
||||||
|
party?: {
|
||||||
|
id?: string;
|
||||||
|
size?: [number, number];
|
||||||
|
};
|
||||||
|
assets?: {
|
||||||
|
large_image: string;
|
||||||
|
large_text: string;
|
||||||
|
small_image: string;
|
||||||
|
small_text: string;
|
||||||
|
};
|
||||||
|
secrets?: {
|
||||||
|
join?: string;
|
||||||
|
spectate?: string;
|
||||||
|
match?: string;
|
||||||
|
};
|
||||||
|
instance?: boolean;
|
||||||
|
flags?: bigint;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ActivityType {
|
||||||
|
GAME = 0,
|
||||||
|
STREAMING = 1,
|
||||||
|
LISTENING = 2,
|
||||||
|
CUSTOM = 4,
|
||||||
|
COMPETING = 5,
|
||||||
|
}
|
44
src/models/Application.ts
Normal file
44
src/models/Application.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
export interface ApplicationCommand {
|
||||||
|
id: bigint;
|
||||||
|
application_id: bigint;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
options?: ApplicationCommandOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationCommandOption {
|
||||||
|
type: ApplicationCommandOptionType;
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
required?: boolean;
|
||||||
|
choices?: ApplicationCommandOptionChoice[];
|
||||||
|
options?: ApplicationCommandOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationCommandOptionChoice {
|
||||||
|
name: string;
|
||||||
|
value: string | number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ApplicationCommandOptionType {
|
||||||
|
SUB_COMMAND = 1,
|
||||||
|
SUB_COMMAND_GROUP = 2,
|
||||||
|
STRING = 3,
|
||||||
|
INTEGER = 4,
|
||||||
|
BOOLEAN = 5,
|
||||||
|
USER = 6,
|
||||||
|
CHANNEL = 7,
|
||||||
|
ROLE = 8,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationCommandInteractionData {
|
||||||
|
id: bigint;
|
||||||
|
name: string;
|
||||||
|
options?: ApplicationCommandInteractionDataOption[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationCommandInteractionDataOption {
|
||||||
|
name: string;
|
||||||
|
value?: any;
|
||||||
|
options?: ApplicationCommandInteractionDataOption[];
|
||||||
|
}
|
@ -1,15 +1,27 @@
|
|||||||
export interface Channel {
|
export interface Channel {
|
||||||
id: bigint;
|
id: bigint;
|
||||||
guild_id: bigint;
|
created_at: number;
|
||||||
last_message_id: string;
|
|
||||||
last_pin_timestamp: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
nsfw: boolean;
|
|
||||||
parent_id: bigint;
|
|
||||||
position: number;
|
|
||||||
rate_limit_per_user: number;
|
|
||||||
topic: string | null;
|
|
||||||
type: number;
|
type: number;
|
||||||
|
read_state: ReadState[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ReadState {
|
||||||
|
last_message_id: bigint;
|
||||||
|
last_pin_timestamp: number;
|
||||||
|
mention_count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TextBasedChannel {
|
||||||
|
messages: any[];
|
||||||
|
last_message_id?: bigint;
|
||||||
|
last_pin_timestamp?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GuildChannel extends Channel {
|
||||||
|
guild_id: bigint;
|
||||||
|
position: number;
|
||||||
|
parent_id?: bigint;
|
||||||
permission_overwrites: {
|
permission_overwrites: {
|
||||||
allow: bigint;
|
allow: bigint;
|
||||||
deny: bigint;
|
deny: bigint;
|
||||||
@ -17,3 +29,26 @@ export interface Channel {
|
|||||||
type: number;
|
type: number;
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VoiceChannel extends GuildChannel {}
|
||||||
|
|
||||||
|
export interface TextChannel extends GuildChannel, TextBasedChannel {
|
||||||
|
nsfw: boolean;
|
||||||
|
rate_limit_per_user: number;
|
||||||
|
topic?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DMChannel extends Channel, TextBasedChannel {
|
||||||
|
owner_id: bigint;
|
||||||
|
recipients: bigint[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum ChannelType {
|
||||||
|
GUILD_TEXT = 0, // a text channel within a server
|
||||||
|
DM = 1, // a direct message between users
|
||||||
|
GUILD_VOICE = 2, // a voice channel within a server
|
||||||
|
GROUP_DM = 3, // a direct message between multiple users
|
||||||
|
GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels
|
||||||
|
GUILD_NEWS = 5, // a channel that users can follow and crosspost into their own server
|
||||||
|
GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord
|
||||||
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Channel } from "./Channel";
|
import { GuildChannel } from "./Channel";
|
||||||
import { Emoji } from "./Emoji";
|
import { Emoji } from "./Emoji";
|
||||||
import { Member } from "./Member";
|
import { Member } from "./Member";
|
||||||
import { Role } from "./Role";
|
import { Role } from "./Role";
|
||||||
@ -8,13 +8,13 @@ export interface Guild {
|
|||||||
afk_timeout?: number;
|
afk_timeout?: number;
|
||||||
application_id?: bigint;
|
application_id?: bigint;
|
||||||
banner?: string;
|
banner?: string;
|
||||||
channels: Channel[];
|
channels: GuildChannel[];
|
||||||
default_message_notifications?: number;
|
default_message_notifications?: number;
|
||||||
description?: string;
|
description?: string;
|
||||||
discovery_splash?: string;
|
discovery_splash?: string;
|
||||||
emojis: Emoji[];
|
emojis: Emoji[];
|
||||||
explicit_content_filter?: number;
|
explicit_content_filter?: number;
|
||||||
features: [];
|
features: string[];
|
||||||
icon?: string;
|
icon?: string;
|
||||||
id: bigint;
|
id: bigint;
|
||||||
// joined_at?: number; \n // owner?: boolean; // ! member specific should be removed
|
// joined_at?: number; \n // owner?: boolean; // ! member specific should be removed
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
export interface Guild {
|
|
||||||
id: bigint;
|
|
||||||
name: string;
|
|
||||||
icon: string; // e.g. "28776e7ad42922582be25bb06cdc5b53"
|
|
||||||
afk_channel_id: bigint;
|
|
||||||
afk_timeout: number;
|
|
||||||
application_id: bigint;
|
|
||||||
banner: string; // id
|
|
||||||
description: string;
|
|
||||||
explicit_content_filter: number;
|
|
||||||
features: string[];
|
|
||||||
/* guild_hashes: // ? what is this
|
|
||||||
channels: {hash: "uZsNP+TWAFY", omitted: false}
|
|
||||||
metadata: {hash: "JCboqYj68bQ", omitted: false}
|
|
||||||
roles: {hash: "1d7EJBRgVqg", omitted: false}
|
|
||||||
version: 1
|
|
||||||
*/
|
|
||||||
joined_at: string; // user specific, Date Iso: "2021-01-23T19:01:23.126002+00:00"
|
|
||||||
large: boolean;
|
|
||||||
lazy: boolean; // ? what is this
|
|
||||||
max_members: number; // e.g. default 100.000
|
|
||||||
max_video_channel_users: number; // ? default: 25, is this max 25 streaming or watching
|
|
||||||
member_count: number; // current member count
|
|
||||||
mfa_level: number;
|
|
||||||
owner_id: bigint;
|
|
||||||
preferred_locale: string; // only partnered/verified guilds can choose this
|
|
||||||
premium_subscription_count: number; // number of boosts
|
|
||||||
premium_tier: number; // ? what is this
|
|
||||||
public_updates_channel_id: bigint; //
|
|
||||||
rules_channel_id: bigint;
|
|
||||||
splash: string; // e.g. "32bec3d01f1dc90933cbb0bd75d333b0"
|
|
||||||
system_channel_flags: number;
|
|
||||||
system_channel_id: bigint;
|
|
||||||
vanity_url_code: string;
|
|
||||||
verification_level: number;
|
|
||||||
threads: []; // ? not yet finished
|
|
||||||
}
|
|
32
src/models/Interaction.ts
Normal file
32
src/models/Interaction.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { AllowedMentions, Embed } from "./Message";
|
||||||
|
|
||||||
|
export interface Interaction {
|
||||||
|
id: bigint;
|
||||||
|
type: InteractionType;
|
||||||
|
data?: {};
|
||||||
|
guild_id: bigint;
|
||||||
|
channel_id: bigint;
|
||||||
|
member_id: bigint;
|
||||||
|
token: string;
|
||||||
|
version: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum InteractionType {
|
||||||
|
Ping = 1,
|
||||||
|
ApplicationCommand = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum InteractionResponseType {
|
||||||
|
Pong = 1,
|
||||||
|
Acknowledge = 2,
|
||||||
|
ChannelMessage = 3,
|
||||||
|
ChannelMessageWithSource = 4,
|
||||||
|
AcknowledgeWithSource = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InteractionApplicationCommandCallbackData {
|
||||||
|
tts?: boolean;
|
||||||
|
content: string;
|
||||||
|
embeds?: Embed[];
|
||||||
|
allowed_mentions?: AllowedMentions;
|
||||||
|
}
|
@ -1,5 +1,10 @@
|
|||||||
export interface Invite {
|
export interface Invite {
|
||||||
code: string;
|
code: string;
|
||||||
|
temporary: boolean;
|
||||||
|
uses: number;
|
||||||
|
max_uses: number;
|
||||||
|
max_age: number;
|
||||||
|
created_at: number;
|
||||||
guild: {
|
guild: {
|
||||||
id: bigint;
|
id: bigint;
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { PublicUser } from "./User";
|
||||||
|
|
||||||
export interface Member {
|
export interface Member {
|
||||||
id: bigint;
|
id: bigint;
|
||||||
nick?: string;
|
nick?: string;
|
||||||
@ -8,4 +10,30 @@ export interface Member {
|
|||||||
mute: boolean;
|
mute: boolean;
|
||||||
pending: boolean;
|
pending: boolean;
|
||||||
permissions: bigint;
|
permissions: bigint;
|
||||||
|
settings: UserGuildSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicMember extends Omit<Member, "settings" | "id"> {
|
||||||
|
user: PublicUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserGuildSettings {
|
||||||
|
channel_overrides: {
|
||||||
|
channel_id: bigint;
|
||||||
|
message_notifications: number;
|
||||||
|
mute_config: MuteConfig;
|
||||||
|
muted: boolean;
|
||||||
|
}[];
|
||||||
|
message_notifications: number;
|
||||||
|
mobile_push: boolean;
|
||||||
|
mute_config: MuteConfig;
|
||||||
|
muted: boolean;
|
||||||
|
suppress_everyone: boolean;
|
||||||
|
suppress_roles: boolean;
|
||||||
|
version: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MuteConfig {
|
||||||
|
end_time: number;
|
||||||
|
selected_time_window: number;
|
||||||
}
|
}
|
||||||
|
126
src/models/Message.ts
Normal file
126
src/models/Message.ts
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
import { ChannelType } from "./Channel";
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: bigint;
|
||||||
|
author_id?: bigint;
|
||||||
|
webhook_id?: bigint;
|
||||||
|
application_id: bigint;
|
||||||
|
content: string;
|
||||||
|
timestamp: number;
|
||||||
|
edited_timestamp: number;
|
||||||
|
tts: boolean;
|
||||||
|
mention_everyone: boolean;
|
||||||
|
mentions: bigint[];
|
||||||
|
mention_roles: bigint[];
|
||||||
|
mention_channels?: {
|
||||||
|
id: bigint;
|
||||||
|
guild_id: bigint;
|
||||||
|
type: ChannelType;
|
||||||
|
name: string;
|
||||||
|
}[];
|
||||||
|
attachments: Attachment[];
|
||||||
|
embeds: Embed[];
|
||||||
|
reactions?: Reaction[];
|
||||||
|
nonce?: string | number;
|
||||||
|
pinned: boolean;
|
||||||
|
type: MessageType;
|
||||||
|
activity?: {
|
||||||
|
type: number;
|
||||||
|
party_id: string;
|
||||||
|
}[];
|
||||||
|
flags?: bigint;
|
||||||
|
stickers?: [];
|
||||||
|
message_reference?: {
|
||||||
|
message_id: bigint;
|
||||||
|
channel_id?: bigint;
|
||||||
|
guild_id?: bigint;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum MessageType {
|
||||||
|
DEFAULT = 0,
|
||||||
|
RECIPIENT_ADD = 1,
|
||||||
|
RECIPIENT_REMOVE = 2,
|
||||||
|
CALL = 3,
|
||||||
|
CHANNEL_NAME_CHANGE = 4,
|
||||||
|
CHANNEL_ICON_CHANGE = 5,
|
||||||
|
CHANNEL_PINNED_MESSAGE = 6,
|
||||||
|
GUILD_MEMBER_JOIN = 7,
|
||||||
|
USER_PREMIUM_GUILD_SUBSCRIPTION = 8,
|
||||||
|
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9,
|
||||||
|
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10,
|
||||||
|
USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11,
|
||||||
|
CHANNEL_FOLLOW_ADD = 12,
|
||||||
|
GUILD_DISCOVERY_DISQUALIFIED = 14,
|
||||||
|
GUILD_DISCOVERY_REQUALIFIED = 15,
|
||||||
|
REPLY = 19,
|
||||||
|
APPLICATION_COMMAND = 20,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Attachment {
|
||||||
|
id: bigint; // attachment id
|
||||||
|
filename: string; // name of file attached
|
||||||
|
size: number; // size of file in bytes
|
||||||
|
url: string; // source url of file
|
||||||
|
proxy_url: string; // a proxied url of file
|
||||||
|
height: number; // height of file (if image)
|
||||||
|
width: number; // width of file (if image)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Embed {
|
||||||
|
title?: string; //title of embed
|
||||||
|
type?: string; // type of embed (always "rich" for webhook embeds)
|
||||||
|
description?: string; // description of embed
|
||||||
|
url?: string; // url of embed
|
||||||
|
timestamp?: number; // timestamp of embed content
|
||||||
|
color?: number; // color code of the embed
|
||||||
|
footer?: {
|
||||||
|
text: string;
|
||||||
|
icon_url?: string;
|
||||||
|
proxy_icon_url?: string;
|
||||||
|
}; // footer object footer information
|
||||||
|
image?: EmbedImage; // image object image information
|
||||||
|
thumbnail?: EmbedImage; // thumbnail object thumbnail information
|
||||||
|
video?: EmbedImage; // video object video information
|
||||||
|
provider?: {
|
||||||
|
name?: string;
|
||||||
|
url?: string;
|
||||||
|
}; // provider object provider information
|
||||||
|
author?: {
|
||||||
|
name?: string;
|
||||||
|
url?: string;
|
||||||
|
icon_url?: string;
|
||||||
|
proxy_icon_url?: string;
|
||||||
|
}; // author object author information
|
||||||
|
fields?: {
|
||||||
|
name: string;
|
||||||
|
value: string;
|
||||||
|
inline?: boolean;
|
||||||
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EmbedImage {
|
||||||
|
url?: string;
|
||||||
|
proxy_url?: string;
|
||||||
|
height?: number;
|
||||||
|
width?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Reaction {
|
||||||
|
count: number;
|
||||||
|
//// not saved in the database // me: boolean; // whether the current user reacted using this emoji
|
||||||
|
emoji: PartialEmoji;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialEmoji {
|
||||||
|
id?: bigint;
|
||||||
|
name: string;
|
||||||
|
animated?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AllowedMentions {
|
||||||
|
parse?: ("users" | "roles" | "everyone")[];
|
||||||
|
roles?: bigint[];
|
||||||
|
users?: bigint[];
|
||||||
|
replied_user?: boolean;
|
||||||
|
}
|
7
src/models/Status.ts
Normal file
7
src/models/Status.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export type Status = "idle" | "dnd" | "online" | "offline";
|
||||||
|
|
||||||
|
export interface ClientStatus {
|
||||||
|
desktop?: string; // e.g. Windows/Linux/Mac
|
||||||
|
mobile?: string; // e.g. iOS/Android
|
||||||
|
web?: string; // e.g. browser, bot account
|
||||||
|
}
|
@ -1,21 +1,55 @@
|
|||||||
import { UserFlags } from "../util/UserFlags";
|
|
||||||
|
|
||||||
export interface User {
|
export interface User {
|
||||||
id: bigint;
|
id: bigint;
|
||||||
username: string;
|
username: string;
|
||||||
discriminator: string;
|
discriminator: string;
|
||||||
avatar: string | null;
|
avatar: string | null;
|
||||||
|
phone?: string;
|
||||||
|
desktop: boolean;
|
||||||
|
mobile: boolean;
|
||||||
|
premium: boolean;
|
||||||
|
premium_type: number;
|
||||||
bot: boolean;
|
bot: boolean;
|
||||||
system: boolean;
|
system: boolean;
|
||||||
|
nsfw_allowed: boolean;
|
||||||
mfa_enabled: boolean;
|
mfa_enabled: boolean;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
verified: boolean;
|
verified: boolean;
|
||||||
email: string;
|
email: string;
|
||||||
flags: bigint; // TODO: automatically convert BigInt to BitField of UserFlags
|
flags: bigint; // TODO: automatically convert BigInt to BitField of UserFlags
|
||||||
|
public_flags: bigint;
|
||||||
hash: string; // hash of the password, salt is saved in password (bcrypt)
|
hash: string; // hash of the password, salt is saved in password (bcrypt)
|
||||||
|
guilds: bigint[]; // array of guild ids the user is part of
|
||||||
valid_tokens_since: number; // all tokens with a previous issue date are invalid
|
valid_tokens_since: number; // all tokens with a previous issue date are invalid
|
||||||
user_settings: UserSettings;
|
user_settings: UserSettings;
|
||||||
guilds: bigint[] // array of guild ids the user is part of
|
relationships: Relationship[];
|
||||||
|
connected_accounts: ConnectedAccount[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicUser {
|
||||||
|
id: bigint;
|
||||||
|
discriminator: string;
|
||||||
|
username: string;
|
||||||
|
avatar?: string;
|
||||||
|
publicFlags: bigint;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConnectedAccount {
|
||||||
|
access_token: string;
|
||||||
|
friend_sync: boolean;
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
revoked: boolean;
|
||||||
|
show_activity: boolean;
|
||||||
|
type: string;
|
||||||
|
verifie: boolean;
|
||||||
|
visibility: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Relationship {
|
||||||
|
id: bigint;
|
||||||
|
nickname?: string;
|
||||||
|
type: number;
|
||||||
|
user_id: bigint;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserSettings {
|
export interface UserSettings {
|
||||||
|
15
src/models/VoiceState.ts
Normal file
15
src/models/VoiceState.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { PublicMember } from "./Member";
|
||||||
|
|
||||||
|
export interface VoiceState {
|
||||||
|
guild_id?: bigint;
|
||||||
|
channel_id: bigint;
|
||||||
|
user_id: bigint;
|
||||||
|
session_id: string;
|
||||||
|
deaf: boolean;
|
||||||
|
mute: boolean;
|
||||||
|
self_deaf: boolean;
|
||||||
|
self_mute: boolean;
|
||||||
|
self_stream?: boolean;
|
||||||
|
self_video: boolean;
|
||||||
|
suppress: boolean; // whether this user is muted by the current user
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user