diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 03aee54..90d7f02 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: # Direct dependencies yarn install # Peer dependencies - npm i --no-save eris@0.13 + npm i --no-save eris@0.15 - name: Build Typescript run: | diff --git a/package.json b/package.json index d7d2aad..8130f27 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,6 @@ "typescript": "4" }, "peerDependencies": { - "eris": "^0.13.0" + "eris": "^0.15.0" } } diff --git a/src/Client.ts b/src/Client.ts index 629d887..f7b54a2 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -42,11 +42,11 @@ export interface ClientOptions extends Eris.ClientOptions { } -/** Information returned from the API about the bot's OAuth application. */ -// TODO: obviated by https://github.com/abalabahaha/eris/pull/467 -export interface ClientOAuthApplication extends Resolved> { - // nothing else added -} +/** + * Information returned from the API about the bot's OAuth application. + * @deprecated Use `Eris.OAuthApplicationInfo` instead (this is a direct alias) + */ +export type ClientOAuthApplication = Eris.OAuthApplicationInfo; // A function that takes a message and a context argument and returns a prefix, // an array of prefixes, or void. diff --git a/src/Command.ts b/src/Command.ts index f1d4d45..92130ac 100644 --- a/src/Command.ts +++ b/src/Command.ts @@ -81,7 +81,7 @@ export interface CommandRequirements { * A list of permission strings the user must have. If set, the `guildOnly` * option is implied. */ - permissions?: string[]; + permissions?: (keyof Eris.Constants["Permissions"])[]; /** A custom function that must return true to enable the command. */ custom?(msg: Eris.Message, args: string[], ctx: CommandContext): boolean | Promise; } diff --git a/src/EventListener.ts b/src/EventListener.ts index 75244a2..1096949 100644 --- a/src/EventListener.ts +++ b/src/EventListener.ts @@ -48,42 +48,46 @@ export class EventListener implements EventListenerOptions { constructor(event: "channelCreate" | "channelDelete", listener: (channel: Eris.AnyChannel, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "channelPinUpdate", listener: (channel: Eris.TextableChannel, timestamp: number, oldTimestamp: number, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "channelRecipientAdd" | "channelRecipientRemove", listener: (channel: Eris.GroupChannel, user: Eris.User, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "channelUpdate", listener: (channel: Eris.AnyGuildChannel, oldChannel: Eris.OldGuildChannel, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "channelUpdate", listener: (channel: Eris.AnyChannel, oldChannel: Eris.OldGuildChannel | Eris.OldGroupChannel, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "connect" | "shardPreReady", listener: (id: number, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "friendSuggestionCreate", listener: (user: Eris.User, reasons: Eris.FriendSuggestionReasons, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "friendSuggestionDelete", listener: (user: Eris.User, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "guildAvailable" | "guildBanAdd" | "guildBanRemove", listener: (guild: Eris.Guild, user: Eris.User, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "guildDelete" | "guildUnavailable" | "guildCreate", listener: (guild: Eris.Guild, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "guildEmojisUpdate", listener: (guild: Eris.Guild, emojis: Eris.Emoji[], oldEmojis: Eris.Emoji[], context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "guildBanAdd" | "guildBanRemove", listener: (guild: Eris.Guild, user: Eris.User, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "guildAvailable" | "guildCreate", listener: (guild: Eris.Guild, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "guildDelete", listener: (guild: Eris.PossiblyUncachedGuild, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "guildEmojisUpdate", listener: (guild: Eris.PossiblyUncachedGuild, emojis: Eris.Emoji[], oldEmojis: Eris.Emoji[] | null, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "guildMemberAdd", listener: (guild: Eris.Guild, member: Eris.Member, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "guildMemberChunk", listener: (guild: Eris.Guild, members: Eris.Member[], context: EventContext) => void, options?: EventListenerOptions); constructor(event: "guildMemberRemove", listener: (guild: Eris.Guild, member: Eris.Member | Eris.MemberPartial, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "guildMemberUpdate", listener: (guild: Eris.Guild, member: Eris.Member, oldMember: { roles: string[]; nick?: string }, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "guildMemberUpdate", listener: (guild: Eris.Guild, member: Eris.Member, oldMember: { nick?: string; premiumSince: number; roles: string[]; pending?: boolean } | null, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "guildRoleCreate" | "guildRoleDelete", listener: (guild: Eris.Guild, role: Eris.Role, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "guildRoleUpdate", listener: (guild: Eris.Guild, role: Eris.Role, oldRole: Eris.OldRole, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "guildUnavailable" | "unavailableGuildCreate", listener: (guild: Eris.UnavailableGuild, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "guildUpdate", listener: (guild: Eris.Guild, oldGuild: Eris.OldGuild, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "hello", listener: (trace: string[], id: number, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "inviteCreate" | "inviteDelete", listener: (guild: Eris.Guild, invite: Eris.GuildInvite, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "messageCreate", listener: (message: Eris.Message, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "inviteCreate" | "inviteDelete", listener: (guild: Eris.Guild, invite: Eris.Invite, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "messageCreate", listener: (message: Eris.Message, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "messageDelete" | "messageReactionRemoveAll", listener: (message: Eris.PossiblyUncachedMessage, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "messageReactionRemoveEmoji", listener: (message: Eris.PossiblyUncachedMessage, emoji: Eris.PartialEmoji, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "messageDeleteBulk", listener: (messages: Eris.PossiblyUncachedMessage[], context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "messageReactionAdd" | "messageReactionRemove", listener: (message: Eris.PossiblyUncachedMessage, emoji: Eris.Emoji, userID: string, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "messageUpdate", listener: (message: Eris.Message, oldMessage: Eris.OldMessage | undefined, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "presenceUpdate", listener: (other: Eris.Member | Eris.Relationship, oldPresence: Eris.Presence | undefined, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "messageReactionAdd", listener: (message: Eris.PossiblyUncachedMessage, emoji: Eris.Emoji, reactor: Eris.Member | { id: string }, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "messageReactionRemove", listener: (message: Eris.PossiblyUncachedMessage, emoji: Eris.PartialEmoji, userID: string, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "messageUpdate", listener: (message: Eris.Message, oldMessage: Eris.OldMessage | null, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "presenceUpdate", listener: (other: Eris.Member | Eris.Relationship, oldPresence: Eris.Presence | null, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "rawREST", listener: (request: Eris.RawRESTRequest, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "rawWS" | "unknown", listener: (packet: Eris.RawPacket, id: number, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "relationshipAdd" | "relationshipRemove", listener: (relationship: Eris.Relationship, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "relationshipUpdate", listener: (relationship: Eris.Relationship, oldRelationship: { type: number }, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "typingStart", listener: (channel: Eris.TextableChannel, user: Eris.User, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "unavailableGuildCreate", listener: (guild: Eris.UnavailableGuild, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "userUpdate", listener: (user: Eris.User, oldUser: { username: string; discriminator: string; avatar?: string }, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "voiceChannelJoin", listener: (member: Eris.Member, newChannel: Eris.VoiceChannel, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "voiceChannelLeave", listener: (member: Eris.Member, oldChannel: Eris.VoiceChannel, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "voiceChannelSwitch", listener: (member: Eris.Member, newChannel: Eris.VoiceChannel, oldChannel: Eris.VoiceChannel, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "typingStart", listener: (channel: Eris.TextableChannel | { id: string }, user: Eris.User | { id: string }, member: Eris.Member | null, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "userUpdate", listener: (user: Eris.User, oldUser: Eris.PartialUser | null, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "voiceChannelJoin", listener: (member: Eris.Member, newChannel: Eris.AnyVoiceChannel, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "voiceChannelLeave", listener: (member: Eris.Member, oldChannel: Eris.AnyVoiceChannel, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "voiceChannelSwitch", listener: (member: Eris.Member, newChannel: Eris.AnyVoiceChannel, oldChannel: Eris.AnyVoiceChannel, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "voiceStateUpdate", listener: (member: Eris.Member, oldState: Eris.OldVoiceState, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "warn" | "debug", listener: (message: string, id: number, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: "shardDisconnect" | "error" | "shardPreReady" | "connect",listener: (err: Error, id: number, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "webhooksUpdate", listener: (data: Eris.WebhookData, context: EventContext) => void, options?: EventListenerOptions); constructor(event: "shardReady" | "shardResume", listener: (id: number, context: EventContext) => void, options?: EventListenerOptions); + constructor(event: "shardDisconnect" | "error", listener: (err: Error, id: number, context: EventContext) => void, options?: EventListenerOptions); // Yuuko client events ripped from Client.ts constructor (event: 'commandLoaded', listener: (cmd: Command, context: EventContext) => void, options?: EventListenerOptions); @@ -91,7 +95,7 @@ export class EventListener implements EventListenerOptions { constructor (event: 'postCommand', listener: (cmd: Command, msg: Eris.Message, args: string[], ctx: CommandContext, context: EventContext) => void, options?: EventListenerOptions); constructor (event: 'invalidCommand', listener: (msg: Eris.Message, args: string[], ctx: CommandContext, context: EventContext) => void, options?: EventListenerOptions); - constructor(event: string, listener: Function, { + constructor(event: string, listener: (...args: any) => void, { once = false }: EventListenerOptions = {}) { this.args = [event, listener];