diff --git a/module/client.ts b/module/client.ts index 1bb96d75f..6009da90f 100644 --- a/module/client.ts +++ b/module/client.ts @@ -10,8 +10,6 @@ import { cache } from "../utils/cache.ts"; export let authorization = ""; export let botID = ""; -/** The bot's token. This should never be used by end users. It is meant to be used internally to make requests to the Discord API. */ -export let token = ""; export let eventHandlers: EventHandlers = {}; @@ -31,7 +29,6 @@ export const identifyPayload = { export const createClient = async (data: ClientOptions) => { botID = data.botID; - token = data.token; if (data.eventHandlers) eventHandlers = data.eventHandlers; authorization = `Bot ${data.token}`; diff --git a/module/shard.ts b/module/shard.ts index e6b9498da..e107ede4b 100644 --- a/module/shard.ts +++ b/module/shard.ts @@ -12,7 +12,6 @@ import { import { logRed } from "../utils/logger.ts"; import { sendConstantHeartbeats, previousSequenceNumber } from "./gateway.ts"; -logRed("shard file running"); export const USELESS_ARG_TO_MAKE_DENO_CACHE_WORK = undefined; /** The session id is needed for RESUME functionality when discord disconnects randomly. */ let sessionID = ""; diff --git a/module/shardingManager.ts b/module/shardingManager.ts index 201ec6286..a79b6b56a 100644 --- a/module/shardingManager.ts +++ b/module/shardingManager.ts @@ -315,7 +315,7 @@ function handleDiscordPayload(data: DiscordPayload) { guild?.members.set( options.author.id, createMember( - options.member, + { ...options.member, user: options.author }, options.guild_id, [...guild.roles.values()].map((r) => r.raw), guild.owner_id, diff --git a/structures/channel.ts b/structures/channel.ts index 516425f54..64cade985 100644 --- a/structures/channel.ts +++ b/structures/channel.ts @@ -88,19 +88,17 @@ export function createChannel(data: ChannelCreatePayload) { if (options?.limit && options.limit > 100) return; - const result = - (await RequestManager.get( - endpoints.CHANNEL_MESSAGES(data.id), - options, - )) as MessageCreateOptions[]; + const result = (await RequestManager.get( + endpoints.CHANNEL_MESSAGES(data.id), + options, + )) as MessageCreateOptions[]; return result.map((res) => createMessage(res)); }, /** Get pinned messages in this channel. */ getPins: async () => { - const result = - (await RequestManager.get( - endpoints.CHANNEL_PINS(data.id), - )) as MessageCreateOptions[]; + const result = (await RequestManager.get( + endpoints.CHANNEL_PINS(data.id), + )) as MessageCreateOptions[]; return result.map((res) => createMessage(res)); }, /** Send a message to the channel. Requires SEND_MESSAGES permission. */ @@ -133,6 +131,7 @@ export function createChannel(data: ChannelCreatePayload) { endpoints.CHANNEL_MESSAGES(data.id), content, ); + console.log(result); return createMessage(result); }, diff --git a/structures/guild.ts b/structures/guild.ts index aeaa57316..1e5094ed1 100644 --- a/structures/guild.ts +++ b/structures/guild.ts @@ -229,11 +229,10 @@ export const createGuild = (data: CreateGuildPayload) => { ) { throw new Error(Errors.MISSING_KICK_MEMBERS); } - const result = - (await RequestManager.get( - endpoints.GUILD_PRUNE(data.id), - { days }, - )) as PrunePayload; + const result = (await RequestManager.get( + endpoints.GUILD_PRUNE(data.id), + { days }, + )) as PrunePayload; return result.pruned; }, /** Begin pruning all members in the given time period */