jank-client-fork/webpage/jsontypes.ts
2024-08-21 11:37:26 -05:00

344 lines
9 KiB
TypeScript

type readyjson={
op:number;
t:string;
s:number;
d:{
v:number;
user:mainuserjson;
user_settings:{
index: number,
afk_timeout: number,
allow_accessibility_detection: boolean,
animate_emoji: boolean,
animate_stickers: number,
contact_sync_enabled: boolean,
convert_emoticons: boolean,
custom_status: string,
default_guilds_restricted: boolean,
detect_platform_accounts: boolean,
developer_mode: boolean,
disable_games_tab: boolean,
enable_tts_command: boolean,
explicit_content_filter: 0,
friend_discovery_flags: 0,
friend_source_flags: {
all: boolean
},//might be missing things here
gateway_connected: boolean,
gif_auto_play: boolean,
guild_folders: [],//need an example of this not empty
guild_positions: [],//need an example of this not empty
inline_attachment_media: boolean,
inline_embed_media: boolean,
locale: string,
message_display_compact: boolean,
native_phone_integration_enabled: boolean,
render_embeds: boolean,
render_reactions: boolean,
restricted_guilds: [],//need an example of this not empty
show_current_game: boolean,
status: string,
stream_notifications_enabled: boolean,
theme: string,
timezone_offset: number,
view_nsfw_guilds: boolean
};
guilds:guildjson[];
relationships:{
id:string,
type:0|1|2|3|4,
nickname:string|null,
user:userjson
}[];
read_state:{
entries:{
id: string,
channel_id: string,
last_message_id: string,
last_pin_timestamp: string,
mention_count: number //in theory, the server doesn't actually send this as far as I'm aware
}[],
partial: boolean,
version: number
};
user_guild_settings:{
entries:{
channel_overrides: unknown[],//will have to find example
message_notifications: number,
flags: number,
hide_muted_channels: boolean,
mobile_push: boolean,
mute_config: null,
mute_scheduled_events: boolean,
muted: boolean,
notify_highlights: number,
suppress_everyone: boolean,
suppress_roles: boolean,
version: number,
guild_id: string
}[],
partial: boolean,
version: number
};
private_channels:dirrectjson[];
session_id:string;
country_code:string;
users:userjson[];
merged_members:memberjson[];
sessions:{
active: boolean,
activities: [],//will need to find example of this
client_info: {
version: number
},
session_id: string,
status: string
}[];
resume_gateway_url:string;
consents:{
personalization: {
consented: boolean
}
};
experiments: [],//not sure if I need to do this :P
guild_join_requests: [],//need to get examples
connected_accounts: [],//need to get examples
guild_experiments: [],//need to get examples
geo_ordered_rtc_regions: [],//need to get examples
api_code_version: number,
friend_suggestion_count: number,
analytics_token: string,
tutorial: boolean,
session_type: string,
auth_session_id_hash: string,
notification_settings: {
flags: number
}
}
}
type mainuserjson= userjson & {
flags: number,
mfa_enabled?: boolean,
email?: string,
phone?: string,
verified: boolean,
nsfw_allowed: boolean,
premium: boolean,
purchased_flags: number,
premium_usage_flags: number,
disabled: boolean
}
type userjson={
username: string,
discriminator: string,
id: string,
public_flags: number,
avatar: string,
accent_color: number,
banner?: string,
bio: string,
bot: boolean,
premium_since: string,
premium_type: number,
theme_colors: string,
pronouns: string,
badge_ids: string[],
}
type memberjson= {
index?:number,
id: string,
user: userjson|null,
guild_id: string,
guild: {
id: string
}|null,
nick: string,
roles: string[],
joined_at: string,
premium_since: string,
deaf: boolean,
mute: boolean,
pending: boolean,
last_message_id?: boolean//What???
}
type emojijson={
name:string,
id?:string,
animated?:boolean
}
type guildjson={
application_command_counts: {[key:string]:number},
channels: channeljson[],
data_mode: string,
emojis: emojijson[],
guild_scheduled_events: [],
id: string,
large: boolean,
lazy: boolean,
member_count: number,
premium_subscription_count: number,
properties: {
name: string,
description: string,
icon: string,
splash: string,
banner: string,
features: string[],
preferred_locale: string,
owner_id: string,
application_id: string,
afk_channel_id: string,
afk_timeout: number,
system_channel_id: string,
verification_level: number,
explicit_content_filter: number,
default_message_notifications: number,
mfa_level: number,
vanity_url_code: number,
premium_tier: number,
premium_progress_bar_enabled: boolean,
system_channel_flags: number,
discovery_splash: string,
rules_channel_id: string,
public_updates_channel_id: string,
max_video_channel_users: number,
max_members: number,
nsfw_level: number,
hub_type: null,
home_header: null,
id: string,
latest_onboarding_question_id: string,
max_stage_video_channel_users: number,
nsfw: boolean,
safety_alerts_channel_id: string
},
roles: rolesjson[],
stage_instances: [],
stickers: [],
threads: [],
version: string,
guild_hashes: {},
joined_at: string
}
type channeljson={
id: string,
created_at: string,
name: string,
icon: string,
type: number,
last_message_id: string,
guild_id: string,
parent_id: string,
last_pin_timestamp: string,
default_auto_archive_duration: number,
permission_overwrites: {
id:string,
allow:string,
deny:string,
}[],
video_quality_mode: null,
nsfw: boolean,
topic: string,
retention_policy_id: string,
flags: number,
default_thread_rate_limit_per_user: number,
position: number
}
type rolesjson={
id: string,
guild_id: string,
color: number,
hoist: boolean,
managed: boolean,
mentionable: boolean,
name: string,
permissions: string,
position: number,
icon: string,
unicode_emoji: string,
flags: number
}
type dirrectjson={
id: string,
flags: number,
last_message_id: string,
type: number,
recipients: userjson[],
is_spam: boolean
}
type messagejson={
id: string,
channel_id: string,
guild_id: string,
author: userjson,
member?: memberjson,
content: string,
timestamp: string,
edited_timestamp: string,
tts: boolean,
mention_everyone: boolean,
mentions: [], //need examples to fix
mention_roles: [], //need examples to fix
attachments: filejson[],
embeds: embedjson[],
reactions: {
count:number,
emoji:emojijson,//very likely needs expanding
me:boolean,
}[],
nonce: string,
pinned: boolean,
type: number
}
type filejson={
id:string,
filename:string,
content_type:string,
width?:number,
height?:number,
proxy_url:string|undefined,
url:string,
size:number
};
type embedjson={
type:string|null,
color?:number,
author:{
icon_url?:string,
name?:string,
url?:string,
title?:string,
},
title?:string,
url?:string,
description?:string,
fields?:{
name:string,
value:string,
inline:boolean,
}[],
footer?:{
icon_url?:string,
text?:string,
thumbnail?:string,
},
timestamp?:string,
thumbnail:{
proxy_url:string,
url:string,
width:number,
height:number
},
provider:{
name:string,
}
}
type presencejson={
status: string,
since: number|null,
activities: any[],//bit more complicated but not now
afk: boolean,
user?:userjson,
}
export {readyjson,dirrectjson,channeljson,guildjson,rolesjson,userjson,memberjson,mainuserjson,messagejson,filejson,embedjson,emojijson,presencejson};