handle guild id on guildCreate for channel creation

This commit is contained in:
Skillz
2020-05-21 15:03:26 -04:00
parent 141cb80e3b
commit 453d72f4f0
3 changed files with 3 additions and 11 deletions

View File

@@ -13,9 +13,6 @@ import { configs } from "./configs.ts";
import { Intents } from "./types/options.ts";
import { logYellow } from "./utils/logger.ts";
import { cache } from "./utils/cache.ts";
import { editBotsStatus } from "./utils/utils.ts";
import { StatusType } from "./types/discord.ts";
import { ActivityType } from "./types/activity.ts";
Client({
token: configs.token,
@@ -24,11 +21,6 @@ Client({
eventHandlers: {
ready: () => {
logYellow("Bot ready emitted");
editBotsStatus(
StatusType.DoNotDisturb,
"Testing Name DND",
ActivityType.Listening,
);
},
// raw: (data) => logGreen("[RAW] => " + JSON.stringify(data)),
messageCreate: async (message) => {

View File

@@ -21,13 +21,13 @@ import { Errors } from "../types/errors.ts";
import { RequestManager } from "../module/requestManager.ts";
import { logYellow } from "../utils/logger.ts";
export function createChannel(data: ChannelCreatePayload) {
export function createChannel(data: ChannelCreatePayload, guildID?: string) {
const channel = {
...data,
/** The raw channel data */
raw: data,
/** The guild id of the channel if it is a guild channel. */
guildID: data.guild_id,
guildID: guildID || data.guild_id,
/** The id of the last message sent in this channel */
lastMessageID: data.last_message_id,
/** The amount of users allowed in this voice channel. */

View File

@@ -72,7 +72,7 @@ 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)])),
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. */