Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/abalabahaha/eris into compon…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
bsian03 committed Jul 13, 2021
2 parents 549e6e8 + e194a71 commit 0c5c5b6
Show file tree
Hide file tree
Showing 18 changed files with 244 additions and 191 deletions.
4 changes: 2 additions & 2 deletions examples/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bot.on("error", (err) => {
bot.on("messageCreate", (msg) => { // When a message is created
if(msg.content === "!embed") { // If the message content is "!embed"
bot.createMessage(msg.channel.id, {
embed: {
embeds: [{
title: "I'm an embed!", // Title of the embed
description: "Here is some more info, with **awesome** formatting.\nPretty *neat*, huh?",
author: { // Author property
Expand All @@ -37,7 +37,7 @@ bot.on("messageCreate", (msg) => { // When a message is created
footer: { // Footer text
text: "Created with Eris."
}
}
}]
});
}
});
Expand Down
120 changes: 77 additions & 43 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ declare namespace Eris {
// Guild
type DefaultNotifications = 0 | 1;
type ExplicitContentFilter = 0 | 1 | 2;
type NSFWLevel = 0 | 1 | 2 | 3;
type PossiblyUncachedGuild = Guild | Uncached;
type PremiumTier = 0 | 1 | 2 | 3;
type VerificationLevel = 0 | 1 | 2 | 3 | 4;
Expand All @@ -55,7 +56,9 @@ declare namespace Eris {
allowedMentions?: AllowedMentions;
components?: ActionRow[];
content?: string;
/** @deprecated */
embed?: EmbedOptions;
embeds?: EmbedOptions[];
flags?: number;
messageReference?: MessageReferenceReply;
/** @deprecated */
Expand All @@ -72,7 +75,7 @@ declare namespace Eris {
type InteractionType = 1 | 2;

// Permission
type PermissionType = "role" | "member";
type PermissionType = 0 | 1;

// Presence/Relationship
type ActivityType = BotActivityType | 4;
Expand Down Expand Up @@ -209,8 +212,7 @@ declare namespace Eris {
firstShardID?: number;
getAllUsers?: boolean;
guildCreateTimeout?: number;
guildSubscriptions?: boolean;
intents?: number | IntentStrings[];
intents: number | IntentStrings[];
largeThreshold?: number;
lastShardID?: number;
/** @deprecated */
Expand Down Expand Up @@ -419,7 +421,9 @@ declare namespace Eris {
maxVideoChannelUsers?: number;
mfaLevel: MFALevel;
name: string;
/** @deprecated */
nsfw: boolean;
nsfwLevel: NSFWLevel;
ownerID: string;
preferredLocale?: string;
premiumSubscriptionCount?: number;
Expand Down Expand Up @@ -668,9 +672,6 @@ declare namespace Eris {
limit?: number;
userID?: string;
}
interface GetGuildIntegrationsOptions {
includeApplications?: boolean;
}
interface GetPruneOptions {
days?: number;
includeRoles?: string[];
Expand Down Expand Up @@ -728,9 +729,9 @@ declare namespace Eris {
summary: string;
}
interface IntegrationOptions {
enableEmoticons: string;
expireBehavior: string;
expireGracePeriod: string;
enableEmoticons?: string;
expireBehavior?: string;
expireGracePeriod?: string;
}
interface PruneMemberOptions extends GetPruneOptions {
computePruneCount?: boolean;
Expand Down Expand Up @@ -761,6 +762,27 @@ declare namespace Eris {
channel_id?: string;
enabled: boolean;
}
interface WidgetChannel {
id: string;
name: string;
position: number;
}
interface WidgetData {
channels: WidgetChannel[];
id: string;
instant_invite: string;
members: WidgetMember[];
name: string;
presence_count: number;
}
interface WidgetMember {
avatar: string | null;
avatar_url: string;
discriminator: string;
id: string;
status: string;
username: string;
}

// Invite
interface CreateInviteOptions {
Expand Down Expand Up @@ -800,6 +822,9 @@ declare namespace Eris {
id: string;
user: User;
}
interface MemberRoles extends BaseData {
roles: string[];
}
interface PartialUser {
avatar: string | null;
discriminator: string;
Expand Down Expand Up @@ -953,10 +978,16 @@ declare namespace Eris {
[key: string]: unknown;
}
interface ActivityPartial<T extends ActivityType = BotActivityType> {
name?: string;
type?: T;
name: string;
type: T;
url?: string;
}
interface ClientPresence {
activities: Activity[] | null;
afk: boolean;
since: number | null;
status: Status;
}
interface ClientStatus {
desktop: Status;
mobile: Status;
Expand All @@ -965,7 +996,6 @@ declare namespace Eris {
interface Presence {
activities?: Activity[];
clientStatus?: ClientStatus;
game: Activity | null;
status?: Status;
}

Expand All @@ -990,7 +1020,7 @@ declare namespace Eris {
hoist?: boolean;
mentionable?: boolean;
name?: string;
permissions?: bigint | number;
permissions?: bigint | number | Permission;
}
interface RoleTags {
bot_id?: string;
Expand Down Expand Up @@ -1153,7 +1183,7 @@ declare namespace Eris {
GUILD_STORE: 6;
GUILD_STAGE: 13;
};
GATEWAY_VERSION: 6;
GATEWAY_VERSION: 8;
GatewayOPCodes: {
EVENT: 0;
HEARTBEAT: 1;
Expand Down Expand Up @@ -1276,7 +1306,7 @@ declare namespace Eris {
allVoice: 4629464849n;
all: 8589934591n;
};
REST_VERSION: 7;
REST_VERSION: 8;
StickerFormats: {
PNG: 1;
APNG: 2;
Expand Down Expand Up @@ -1490,7 +1520,7 @@ declare namespace Eris {
lastReconnectDelay: number;
notes: { [s: string]: string };
options: ClientOptions;
presence: Presence;
presence: ClientPresence;
privateChannelMap: { [s: string]: string };
privateChannels: Collection<PrivateChannel>;
ready: boolean;
Expand All @@ -1506,7 +1536,7 @@ declare namespace Eris {
users: Collection<User>;
userSettings: UserSettings;
voiceConnections: VoiceConnectionManager;
constructor(token: string, options?: ClientOptions);
constructor(token: string, options: ClientOptions);
acceptInvite(inviteID: string): Promise<Invite<"withoutCount">>;
addGroupRecipient(groupID: string, userID: string): Promise<void>;
addGuildDiscoverySubcategory(guildID: string, categoryID: string, reason?: string): Promise<DiscoverySubcategoryResponse>;
Expand Down Expand Up @@ -1665,7 +1695,7 @@ declare namespace Eris {
overwriteID: string,
allow: bigint | number,
deny: bigint | number,
type: string,
type: PermissionType,
reason?: string
): Promise<void>;
editChannelPosition(channelID: string, position: number, options?: EditChannelPositionOptions): Promise<void>;
Expand All @@ -1678,7 +1708,7 @@ declare namespace Eris {
reason?: string
): Promise<Emoji>;
editGuildIntegration(guildID: string, integrationID: string, options: IntegrationOptions): Promise<void>;
editGuildMember(guildID: string, memberID: string, options: MemberOptions, reason?: string): Promise<void>;
editGuildMember(guildID: string, memberID: string, options: MemberOptions, reason?: string): Promise<Member>;
editGuildTemplate(guildID: string, code: string, options: GuildTemplateOptions): Promise<GuildTemplate>;
editGuildVanity(guildID: string, code: string | null): Promise<GuildVanity>;
editGuildVoiceState(guildID: string, options: VoiceStateOptions, userID?: string): Promise<void>;
Expand All @@ -1695,7 +1725,8 @@ declare namespace Eris {
data: { friendSync: boolean; visibility: number }
): Promise<Connection>;
editSelfSettings(data: UserSettings): Promise<UserSettings>;
editStatus(status?: Status, game?: ActivityPartial<BotActivityType>): void;
editStatus(status: Status, activities?: ActivityPartial<BotActivityType>[] | ActivityPartial<BotActivityType>): void;
editStatus(activities?: ActivityPartial<BotActivityType>[] | ActivityPartial<BotActivityType>): void;
editUserNote(userID: string, note: string): Promise<void>;
editWebhook(
webhookID: string,
Expand Down Expand Up @@ -1734,15 +1765,16 @@ declare namespace Eris {
getGuildDiscovery(guildID: string): Promise<DiscoveryMetadata>;
/** @deprecated */
getGuildEmbed(guildID: string): Promise<Widget>;
getGuildIntegrations(guildID: string, options?: GetGuildIntegrationsOptions): Promise<GuildIntegration[]>;
getGuildIntegrations(guildID: string): Promise<GuildIntegration[]>;
getGuildInvites(guildID: string): Promise<Invite[]>;
getGuildPreview(guildID: string): Promise<GuildPreview>;
getGuildTemplate(code: string): Promise<GuildTemplate>;
getGuildTemplates(guildID: string): Promise<GuildTemplate[]>;
getGuildVanity(guildID: string): Promise<GuildVanity>;
getGuildWebhooks(guildID: string): Promise<Webhook[]>;
getGuildWelcomeScreen(guildID: string): Promise<WelcomeScreen>;
getGuildWidget(guildID: string): Promise<Widget>;
getGuildWidget(guildID: string): Promise<WidgetData>;
getGuildWidgetSettings(guildID: string): Promise<Widget>;
getInvite(inviteID: string, withCounts?: false): Promise<Invite<"withoutCount">>;
getInvite(inviteID: string, withCounts: true): Promise<Invite<"withCount">>;
getMessage(channelID: string, messageID: string): Promise<Message>;
Expand Down Expand Up @@ -1908,7 +1940,7 @@ declare namespace Eris {
commands: { [s: string]: Command };
guildPrefixes: { [s: string]: string | string[] };
preReady?: true;
constructor(token: string, options?: ClientOptions, commandOptions?: CommandClientOptions);
constructor(token: string, options: ClientOptions, commandOptions?: CommandClientOptions);
checkPrefix(msg: Message): string;
onMessageCreate(msg: Message): Promise<void>;
onMessageReactionEvent(msg: Message, emoji: Emoji, reactor: Member | Uncached | string): Promise<void>
Expand Down Expand Up @@ -1992,7 +2024,9 @@ declare namespace Eris {
members: Collection<Member>;
mfaLevel: MFALevel;
name: string;
/** @deprecated */
nsfw: boolean;
nsfwLevel: NSFWLevel;
ownerID: string;
preferredLocale: string;
premiumSubscriptionCount?: number;
Expand Down Expand Up @@ -2058,7 +2092,7 @@ declare namespace Eris {
editDiscovery(options?: DiscoveryOptions): Promise<DiscoveryMetadata>;
editEmoji(emojiID: string, options: { name: string; roles?: string[] }, reason?: string): Promise<Emoji>;
editIntegration(integrationID: string, options: IntegrationOptions): Promise<void>;
editMember(memberID: string, options: MemberOptions, reason?: string): Promise<void>;
editMember(memberID: string, options: MemberOptions, reason?: string): Promise<Member>;
editNickname(nick: string): Promise<void>;
editRole(roleID: string, options: RoleOptions): Promise<Role>;
editTemplate(code: string, options: GuildTemplateOptions): Promise<GuildTemplate>;
Expand All @@ -2076,7 +2110,7 @@ declare namespace Eris {
getDiscovery(): Promise<DiscoveryMetadata>;
/** @deprecated */
getEmbed(): Promise<Widget>;
getIntegrations(options?: GetGuildIntegrationsOptions): Promise<GuildIntegration>;
getIntegrations(): Promise<GuildIntegration>;
getInvites(): Promise<Invite[]>;
getPruneCount(options?: GetPruneOptions): Promise<number>;
getRESTChannels(): Promise<AnyGuildChannel[]>;
Expand All @@ -2092,11 +2126,12 @@ declare namespace Eris {
getVoiceRegions(): Promise<VoiceRegion[]>;
getWebhooks(): Promise<Webhook[]>;
getWelcomeScreen(): Promise<WelcomeScreen>;
getWidget(): Promise<Widget>;
getWidget(): Promise<WidgetData>;
getWidgetSettings(): Promise<Widget>;
kickMember(userID: string, reason?: string): Promise<void>;
leave(): Promise<void>;
leaveVoiceChannel(): void;
permissionsOf(memberID: string | Member): Permission;
permissionsOf(memberID: string | Member | MemberRoles): Permission;
pruneMembers(options?: PruneMemberOptions): Promise<number>;
removeMemberRole(memberID: string, roleID: string, reason?: string): Promise<void>;
searchMembers(query: string, limit?: number): Promise<Member[]>;
Expand Down Expand Up @@ -2146,29 +2181,29 @@ declare namespace Eris {
): Promise<PermissionOverwrite>;
editPosition(position: number, options?: EditChannelPositionOptions): Promise<void>;
getInvites(): Promise<Invite[]>;
permissionsOf(memberID: string | Member): Permission;
permissionsOf(memberID: string | Member | MemberRoles): Permission;
}

export class GuildIntegration extends Base {
account: { id: string; name: string };
application?: IntegrationApplication;
createdAt: number;
enabled: boolean;
enableEmoticons: boolean;
expireBehavior: number;
expireGracePeriod: number;
enableEmoticons?: boolean;
expireBehavior?: number;
expireGracePeriod?: number;
id: string;
name: string;
revoked: boolean;
roleID: string;
subscriberCount: number;
syncedAt: number;
syncing: boolean;
revoked?: boolean;
roleID?: string;
subscriberCount?: number;
syncedAt?: number;
syncing?: boolean;
type: string;
user?: User;
constructor(data: BaseData, guild: Guild);
delete(): Promise<void>;
edit(options: { enableEmoticons: string; expireBehavior: string; expireGracePeriod: string }): Promise<void>;
edit(options: IntegrationOptions): Promise<void>;
sync(): Promise<void>;
}

Expand Down Expand Up @@ -2406,10 +2441,9 @@ declare namespace Eris {
unsendMessage(messageID: string): Promise<void>;
}

export class Relationship extends Base implements Presence {
activities?: Activity[];
export class Relationship extends Base implements Omit<Presence, "activities"> {
activities: Activity[] | null;
clientStatus?: ClientStatus;
game: Activity | null;
id: string;
status: Status;
type: number;
Expand Down Expand Up @@ -2485,7 +2519,7 @@ declare namespace Eris {
lastHeartbeatSent: number | null;
latency: number;
preReady: boolean;
presence: Presence;
presence: ClientPresence;
presenceUpdateBucket: Bucket;
ready: boolean;
reconnectInterval: number;
Expand All @@ -2501,8 +2535,8 @@ declare namespace Eris {
createGuild(_guild: Guild): Guild;
disconnect(options?: { reconnect?: boolean | "auto" }, error?: Error): void;
editAFK(afk: boolean): void;
editStatus(status?: Status, game?: ActivityPartial<BotActivityType>): void;
editStatus(game?: ActivityPartial<BotActivityType>): void;
editStatus(status: Status, activities?: ActivityPartial<BotActivityType>[] | ActivityPartial<BotActivityType>): void;
editStatus(activities?: ActivityPartial<BotActivityType>[] | ActivityPartial<BotActivityType>): void;
// @ts-ignore: Method override
emit(event: string, ...args: any[]): void;
getGuildMembers(guildID: string, timeout: number): void;
Expand Down
Loading

0 comments on commit 0c5c5b6

Please sign in to comment.