rename to mod.ts

This commit is contained in:
Skillz
2020-12-26 19:30:32 -05:00
parent 0cfdb5fd43
commit 189dc150f2
29 changed files with 46 additions and 46 deletions

View File

@@ -2,7 +2,7 @@ import {
ChannelCreatePayload,
ChannelType,
RawOverwrite,
} from "../../types/types.ts";
} from "../../types/mod.ts";
import { cache } from "../../util/cache.ts";
import { Collection } from "../../util/collection.ts";
import { createNewProp } from "../../util/utils.ts";
@@ -93,15 +93,15 @@ export interface Channel {
// GETTERS
/**
/**
* Gets the guild object for this channel.
*
*
* ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async.
*/
guild?: Guild;
/**
/**
* Gets the messages from cache that were sent in this channel
*
*
* ⚠️ ADVANCED: If you use the custom cache, these will not work for you. Getters can not be async and custom cache requires async.
*/
messages: Collection<string, Message>;

View File

@@ -1,6 +1,7 @@
import { botID } from "../../bot.ts";
import {
BannedUser,
ChannelCreatePayload,
CreateGuildPayload,
Emoji,
GetAuditLogsOptions,
@@ -11,8 +12,9 @@ import {
ImageSize,
MemberCreatePayload,
Presence,
RoleData,
VoiceState,
} from "../../types/types.ts";
} from "../../types/mod.ts";
import { cache } from "../../util/cache.ts";
import { Collection } from "../../util/collection.ts";
import { createNewProp } from "../../util/utils.ts";
@@ -133,11 +135,13 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) {
} = data;
const roles = await Promise.all(
data.roles.map((r) => structures.createRole(r)),
);
data.roles.map((r: RoleData) => structures.createRole(r)),
) as Role[];
await Promise.all(
channels.map((c) => structures.createChannel(c, data.id)),
channels.map((c: ChannelCreatePayload) =>
structures.createChannel(c, data.id)
),
);
const restProps: Record<string, ReturnType<typeof createNewProp>> = {};
@@ -170,14 +174,14 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) {
premiumTier: createNewProp(premiumTier),
premiumSubscriptionCount: createNewProp(premiumSubscriptionCount),
preferredLocale: createNewProp(preferredLocale),
roles: createNewProp(new Collection(roles.map((r) => [r.id, r]))),
roles: createNewProp(new Collection(roles.map((r: Role) => [r.id, r]))),
joinedAt: createNewProp(Date.parse(joinedAt)),
presences: createNewProp(
new Collection(data.presences.map((p) => [p.user.id, p])),
new Collection(data.presences.map((p: Presence) => [p.user.id, p])),
),
memberCount: createNewProp(memberCount || 0),
voiceStates: createNewProp(
new Collection(voiceStates.map((vs) => [vs.user_id, {
new Collection(voiceStates.map((vs: VoiceState) => [vs.user_id, {
...vs,
guildID: vs.guild_id,
channelID: vs.channel_id,

View File

@@ -4,7 +4,7 @@ import {
GuildMember,
MemberCreatePayload,
MessageContent,
} from "../../types/types.ts";
} from "../../types/mod.ts";
import { cache } from "../../util/cache.ts";
import { Collection } from "../../util/collection.ts";
import { createNewProp } from "../../util/utils.ts";

View File

@@ -10,7 +10,7 @@ import {
Reaction,
Reference,
UserPayload,
} from "../../types/types.ts";
} from "../../types/mod.ts";
import { cache } from "../../util/cache.ts";
import { createNewProp } from "../../util/utils.ts";
import { sendMessage } from "../handlers/channel.ts";

View File

@@ -1,4 +1,4 @@
import { CreateRoleOptions, RoleData } from "../../types/types.ts";
import { CreateRoleOptions, RoleData } from "../../types/mod.ts";
import { cache } from "../../util/cache.ts";
import { Collection } from "../../util/collection.ts";
import { createNewProp } from "../../util/utils.ts";

View File

@@ -1,4 +1,4 @@
import { GuildTemplate, UserPayload } from "../../types/types.ts";
import { GuildTemplate, UserPayload } from "../../types/mod.ts";
import { cache } from "../../util/cache.ts";
import { createNewProp } from "../../util/utils.ts";
import { Guild } from "./guild.ts";