This commit is contained in:
Skillz
2020-05-22 15:58:22 -04:00
parent 94d2a36c25
commit 41620c2df2
5 changed files with 9 additions and 7 deletions

View File

@@ -70,7 +70,9 @@ export const createGuild = (data: CreateGuildPayload) => {
/** The users in this guild. */
members: new Map<string, Member>(),
/** The channels in the guild */
channels: new Map(data.channels.map((c) => [c.id, createChannel(c, data.id)])),
channels: new Map(
data.channels.map((c) => [c.id, createChannel(c, data.id)]),
),
/** The presences of all the users in the guild. */
presences: new Map(data.presences.map((p) => [p.user.id, p])),
/** The total number of members in this guild. This value is updated as members leave and join the server. However, if you do not have the intent enabled to be able to listen to these events, then this will not be accurate. */

View File

@@ -18,7 +18,7 @@ import { createUser } from "./user.ts";
export const createMember = (data: MemberCreatePayload, guild: Guild) => {
// Add the user to cache as well
cache.users.set(data.user.id, createUser(data.user))
cache.users.set(data.user.id, createUser(data.user));
return {
...data,

View File

@@ -1,5 +1,5 @@
import { Activity } from "./message.ts";
import { Client_Status_Payload } from "./presence.ts";
import { ClientStatusPayload } from "./presence.ts";
import { Partial_User } from "./guild.ts";
import { MemberCreatePayload } from "./member.ts";
@@ -211,7 +211,7 @@ export interface PresenceUpdatePayload {
/** All user's current activity */
activities: Activity[];
/** The user's platform dependent status */
client_status: Client_Status_Payload;
client_status: ClientStatusPayload;
/** When the user has started boosting the guild */
premium_since?: string | null;
/** This users guild nickname (if one is set) */

View File

@@ -4,7 +4,7 @@ import { Permission } from "./permission.ts";
import { RoleData } from "./role.ts";
import { MemberCreatePayload } from "./member.ts";
import { Activity } from "./message.ts";
import { Client_Status_Payload } from "./presence.ts";
import { ClientStatusPayload } from "./presence.ts";
import { ChannelCreatePayload } from "./channel.ts";
export interface GuildRolePayload {
@@ -567,7 +567,7 @@ export interface Presence {
/** Either idle */
status: StatusType;
activities: Activity[];
client_status: Client_Status_Payload;
client_status: ClientStatusPayload;
premium_since?: string | null;
nick?: string | null;
}

View File

@@ -1,6 +1,6 @@
import { StatusType } from "../types/discord.ts";
export interface Client_Status_Payload {
export interface ClientStatusPayload {
/** The user's status set for an active desktop (Windows, Linux, Mac) application session */
desktop?: StatusType;