mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
handle guild id on guildCreate for channel creation
This commit is contained in:
8
debug.ts
8
debug.ts
@@ -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) => {
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user