Skip to content

Commit

Permalink
refactor(Enums): make property casing consistent (#131)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Enum keys have been normalized, and they are all PascalCased now (for API v8 and above). API v6 did not receive these changes.
  • Loading branch information
vaporoxx committed May 11, 2021
1 parent 557b969 commit aa5e26d
Show file tree
Hide file tree
Showing 22 changed files with 446 additions and 446 deletions.
60 changes: 30 additions & 30 deletions deno/gateway/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const GatewayVersion = '8';
/**
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-opcodes
*/
export enum GatewayOPCodes {
export enum GatewayOpcodes {
/**
* An event was dispatched
*/
Expand Down Expand Up @@ -91,7 +91,7 @@ export enum GatewayCloseCodes {
*
* See https://discord.com/developers/docs/topics/gateway#payloads-and-opcodes
*/
UnknownOpCode,
UnknownOpcode,
/**
* You sent an invalid payload to us. Don't do that!
*
Expand Down Expand Up @@ -165,21 +165,21 @@ export enum GatewayCloseCodes {
* https://discord.com/developers/docs/topics/gateway#list-of-intents
*/
export enum GatewayIntentBits {
GUILDS = 1 << 0,
GUILD_MEMBERS = 1 << 1,
GUILD_BANS = 1 << 2,
GUILD_EMOJIS = 1 << 3,
GUILD_INTEGRATIONS = 1 << 4,
GUILD_WEBHOOKS = 1 << 5,
GUILD_INVITES = 1 << 6,
GUILD_VOICE_STATES = 1 << 7,
GUILD_PRESENCES = 1 << 8,
GUILD_MESSAGES = 1 << 9,
GUILD_MESSAGE_REACTIONS = 1 << 10,
GUILD_MESSAGE_TYPING = 1 << 11,
DIRECT_MESSAGES = 1 << 12,
DIRECT_MESSAGE_REACTIONS = 1 << 13,
DIRECT_MESSAGE_TYPING = 1 << 14,
Guilds = 1 << 0,
GuildMembers = 1 << 1,
GuildBans = 1 << 2,
GuildEmojis = 1 << 3,
GuildIntegrations = 1 << 4,
GuildWebhooks = 1 << 5,
GuildInvites = 1 << 6,
GuildVoiceStates = 1 << 7,
GuildPresences = 1 << 8,
GuildMessages = 1 << 9,
GuildMessageReactions = 1 << 10,
GuildMessageTyping = 1 << 11,
DirectMessages = 1 << 12,
DirectMessageReactions = 1 << 13,
DirectMessageTyping = 1 << 14,
}

/**
Expand Down Expand Up @@ -341,7 +341,7 @@ export type GatewayApplicationCommandDeleteDispatchData = GatewayApplicationComm
* https://discord.com/developers/docs/topics/gateway#hello
*/
export interface GatewayHello extends NonDispatchPayload {
op: GatewayOPCodes.Hello;
op: GatewayOpcodes.Hello;
d: GatewayHelloData;
}

Expand All @@ -359,23 +359,23 @@ export interface GatewayHelloData {
* https://discord.com/developers/docs/topics/gateway#heartbeating
*/
export interface GatewayHeartbeatRequest extends NonDispatchPayload {
op: GatewayOPCodes.Heartbeat;
op: GatewayOpcodes.Heartbeat;
d: never;
}

/**
* https://discord.com/developers/docs/topics/gateway#heartbeating-example-gateway-heartbeat-ack
*/
export interface GatewayHeartbeatAck extends NonDispatchPayload {
op: GatewayOPCodes.HeartbeatAck;
op: GatewayOpcodes.HeartbeatAck;
d: never;
}

/**
* https://discord.com/developers/docs/topics/gateway#invalid-session
*/
export interface GatewayInvalidSession extends NonDispatchPayload {
op: GatewayOPCodes.InvalidSession;
op: GatewayOpcodes.InvalidSession;
d: GatewayInvalidSessionData;
}

Expand All @@ -388,7 +388,7 @@ export type GatewayInvalidSessionData = boolean;
* https://discord.com/developers/docs/topics/gateway#reconnect
*/
export interface GatewayReconnect extends NonDispatchPayload {
op: GatewayOPCodes.Reconnect;
op: GatewayOpcodes.Reconnect;
d: never;
}

Expand Down Expand Up @@ -1250,7 +1250,7 @@ export interface GatewayWebhooksUpdateDispatchData {
* https://discord.com/developers/docs/topics/gateway#heartbeating
*/
export interface GatewayHeartbeat {
op: GatewayOPCodes.Heartbeat;
op: GatewayOpcodes.Heartbeat;
d: GatewayHeartbeatData;
}

Expand All @@ -1263,7 +1263,7 @@ export type GatewayHeartbeatData = number | null;
* https://discord.com/developers/docs/topics/gateway#identify
*/
export interface GatewayIdentify {
op: GatewayOPCodes.Identify;
op: GatewayOpcodes.Identify;
d: GatewayIdentifyData;
}

Expand Down Expand Up @@ -1336,7 +1336,7 @@ export interface GatewayIdentifyProperties {
* https://discord.com/developers/docs/topics/gateway#resume
*/
export interface GatewayResume {
op: GatewayOPCodes.Resume;
op: GatewayOpcodes.Resume;
d: GatewayResumeData;
}

Expand All @@ -1362,7 +1362,7 @@ export interface GatewayResumeData {
* https://discord.com/developers/docs/topics/gateway#request-guild-members
*/
export interface GatewayRequestGuildMembers {
op: GatewayOPCodes.RequestGuildMembers;
op: GatewayOpcodes.RequestGuildMembers;
d: GatewayRequestGuildMembersData;
}

Expand Down Expand Up @@ -1405,7 +1405,7 @@ export interface GatewayRequestGuildMembersData {
* https://discord.com/developers/docs/topics/gateway#update-voice-state
*/
export interface GatewayVoiceStateUpdate {
op: GatewayOPCodes.VoiceStateUpdate;
op: GatewayOpcodes.VoiceStateUpdate;
d: GatewayVoiceStateUpdateData;
}

Expand Down Expand Up @@ -1435,7 +1435,7 @@ export interface GatewayVoiceStateUpdateData {
* https://discord.com/developers/docs/topics/gateway#update-status
*/
export interface GatewayUpdatePresence {
op: GatewayOPCodes.PresenceUpdate;
op: GatewayOpcodes.PresenceUpdate;
d: GatewayPresenceUpdateData;
}

Expand Down Expand Up @@ -1477,7 +1477,7 @@ interface BasePayload {
/**
* Opcode for the payload
*/
op: GatewayOPCodes;
op: GatewayOpcodes;
/**
* Event data
*/
Expand All @@ -1495,7 +1495,7 @@ interface BasePayload {
type NonDispatchPayload = Omit<BasePayload, 't'>;

interface DataPayload<Event extends GatewayDispatchEvents, D = unknown> extends BasePayload {
op: GatewayOPCodes.Dispatch;
op: GatewayOpcodes.Dispatch;
t: Event;
d: D;
}
Expand Down
86 changes: 43 additions & 43 deletions deno/payloads/v8/auditLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,49 +92,49 @@ export interface APIAuditLogEntry {
* https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events
*/
export enum AuditLogEvent {
GUILD_UPDATE = 1,

CHANNEL_CREATE = 10,
CHANNEL_UPDATE,
CHANNEL_DELETE,
CHANNEL_OVERWRITE_CREATE,
CHANNEL_OVERWRITE_UPDATE,
CHANNEL_OVERWRITE_DELETE,

MEMBER_KICK = 20,
MEMBER_PRUNE,
MEMBER_BAN_ADD,
MEMBER_BAN_REMOVE,
MEMBER_UPDATE,
MEMBER_ROLE_UPDATE,
MEMBER_MOVE,
MEMBER_DISCONNECT,
BOT_ADD,

ROLE_CREATE = 30,
ROLE_UPDATE,
ROLE_DELETE,

INVITE_CREATE = 40,
INVITE_UPDATE,
INVITE_DELETE,

WEBHOOK_CREATE = 50,
WEBHOOK_UPDATE,
WEBHOOK_DELETE,

EMOJI_CREATE = 60,
EMOJI_UPDATE,
EMOJI_DELETE,

MESSAGE_DELETE = 72,
MESSAGE_BULK_DELETE,
MESSAGE_PIN,
MESSAGE_UNPIN,

INTEGRATION_CREATE = 80,
INTEGRATION_UPDATE,
INTEGRATION_DELETE,
GuildUpdate = 1,

ChannelCreate = 10,
ChannelUpdate,
ChannelDelete,
ChannelOverwriteCreate,
ChannelOverwriteUpdate,
ChannelOverwriteDelete,

MemberKick = 20,
MemberPrune,
MemberBanAdd,
MemberBanRemove,
MemberUpdate,
MemberRoleUpdate,
MemberMove,
MemberDisconnect,
BotAdd,

RoleCreate = 30,
RoleUpdate,
RoleDelete,

InviteCreate = 40,
InviteUpdate,
InviteDelete,

WebhookCreate = 50,
WebhookUpdate,
WebhookDelete,

EmojiCreate = 60,
EmojiUpdate,
EmojiDelete,

MessageDelete = 72,
MessageBulkDelete,
MessagePin,
MessageUnpin,

IntegrationCreate = 80,
IntegrationUpdate,
IntegrationDelete,
}

/**
Expand Down
Loading

0 comments on commit aa5e26d

Please sign in to comment.