Merge pull request #736 from itohatweb/gateway-things

types: fix gateway types
This commit is contained in:
Skillz4Killz
2021-04-04 07:56:34 -04:00
committed by GitHub
12 changed files with 31 additions and 17 deletions

View File

@@ -1,12 +1,12 @@
import { Emoji } from "../emojis/emoji.ts";
import { SnakeCaseProps } from "../util.ts";
/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */
export interface GuildEmojisUpdate {
/** id of the guild */
guild_id: string;
guildId: string;
/** Array of emojis */
emojis: Emoji[];
}
/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */
export type DiscordGuildEmojisUpdate = SnakeCaseProps<GuildEmojisUpdate>;

View File

@@ -12,7 +12,7 @@ export interface Identify {
/** Value between 50 and 250, total number of members where the gateway will stop sending offline members in the guild member list */
largeThreshold?: number;
/** Used for Guild Sharding */
shard?: [number, number];
shard?: [shardId: number, numberOfShards: number];
/** Presence structure for initial presence information */
presence?: UpdateStatus;
/** Enables dispatching of guild subscription events (presence and typing events) */

View File

@@ -1,4 +1,3 @@
/** https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties */
export interface IdentifyConnectionProperties {
/** Operating system */
$os: string;
@@ -8,4 +7,5 @@ export interface IdentifyConnectionProperties {
$device: string;
}
/** https://discord.com/developers/docs/topics/gateway#identify-identify-connection-properties */
export type DiscordIdentifyConnectionProperties = IdentifyConnectionProperties;

View File

@@ -1,11 +1,11 @@
/** https://discord.com/developers/docs/topics/gateway#resume */
export interface Resume {
/** Session token */
token: string;
/** Session id */
session_id: string;
sessionId: string;
/** Last sequence number received */
seq: number;
}
/** https://discord.com/developers/docs/topics/gateway#resume */
export type DiscordResume = Resume;

View File

@@ -2,7 +2,7 @@ import { Activity } from "../misc/activity.ts";
import { SnakeCaseProps } from "../util.ts";
import { DiscordStatusTypes } from "./status_types.ts";
export interface UpdateStatus {
export interface StatusUpdate {
/** Unix time (in milliseconds) of when the client went idle, or null if the client is not idle */
since: number | null;
/** null, or the user's activities */
@@ -14,4 +14,4 @@ export interface UpdateStatus {
}
/** https://discord.com/developers/docs/topics/gateway#update-status */
export type DiscordUpdateStatus = SnakeCaseProps<UpdateStatus>;
export type DiscordStatusUpdate = SnakeCaseProps<StatusUpdate>;

View File

@@ -1,7 +1,7 @@
import { User } from "../users/user.ts";
import { SnakeCaseProps } from "../util.ts";
export interface GuildBanAdd {
export interface GuildBanAddRemove {
/** id of the guild */
guildId: string;
/** The banned user */
@@ -9,4 +9,4 @@ export interface GuildBanAdd {
}
/** https://discord.com/developers/docs/topics/gateway#guild-ban-add */
export type DiscordGuildBanAdd = SnakeCaseProps<GuildBanAdd>;
export type DiscordGuildBanAddRemove = SnakeCaseProps<GuildBanAddRemove>;

View File

@@ -2,7 +2,7 @@ import { SnakeCaseProps } from "../util.ts";
export interface RequestGuildMembers {
/** id of the guild to get members for */
guild_id: string;
guildId: string;
/** String that username starts with, or an empty string to return all members */
query?: string;
/** Maximum number of members to send matching the query; a limit of 0 can be used with an empty string query to return all members */

View File

@@ -0,0 +1,13 @@
import { SnakeCaseProps } from "../util.ts";
import { ApplicationCommand } from "./application_command.ts";
export interface ApplicationCommandCreateUpdateDelete
extends ApplicationCommand {
/** Id of the guild the command is in */
guildId?: string;
}
/** https://discord.com/developers/docs/topics/gateway#application-command-delete-application-command-extra-fields */
export type DiscordApplicationCommandCreateUpdateDelete = SnakeCaseProps<
ApplicationCommandCreateUpdateDelete
>;

View File

@@ -1,4 +1,5 @@
import { Emoji } from "../emojis/emoji.ts";
import { GuildMember } from "../guilds/guild_member.ts";
import { SnakeCaseProps } from "../util.ts";
export interface MessageReactionAdd {

View File

@@ -14,11 +14,11 @@ export interface Activity {
/** Stream url, is validated when type is 1 */
url?: string | null;
/** Unix timestamp of when the activity was added to the user's session */
created_at: number;
createdAt: number;
/** Unix timestamps for start and/or end of the game */
timestamps?: ActivityTimestamps;
/** Application id for the game */
application_id?: string;
applicationId?: string;
/** What the player is currently doing */
details?: string | null;
/** The user's current party status */

View File

@@ -7,7 +7,7 @@ export interface PresenceUpdate {
/** The user presence is being updated for */
user: User;
/** id of the guild */
guild_id: string;
guildId: string;
/** Either "idle", "dnd", "online", or "offline" */
status: "idle" | "dnd" | "online" | "offline";
/** User's current activities */

View File

@@ -1,11 +1,11 @@
import { SnakeCaseProps } from "../util.ts";
export interface WebhooksUpdate {
export interface WebhookUpdate {
/** id of the guild */
guildId: string;
/** id of the channel */
channelId: string;
}
/** https://discord.com/developers/docs/topics/gateway#webhooks-update */
export type DiscordWebhooksUpdate = SnakeCaseProps<WebhooksUpdate>;
/** https://discord.com/developers/docs/topics/gateway#webhooks-update-webhook-update-event-fields */
export type DiscordWebhookUpdate = SnakeCaseProps<WebhookUpdate>;