mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 18:00:08 +00:00
rename to mod.ts
This commit is contained in:
@@ -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>;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user