mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
refactor: resolve async promises, fixed typos, and used inline variable for return (#299)
* Added await in async function, fixed typos and used inline variable for return
* Added await in async function, fixed typos and used inline variable for return
* Revert "Added await in async function, fixed typos and used inline variable for return"
This reverts commit f31caf5d
* Added await in async function, fixed typos and used inline variable for return
* Fixes format
* Fixes format 2
* Fixes format 4475757
* Fixes format 878757854786312378657865785785785785
* Change return to await
* Fixing more issues
* Fixing even more issues
* Fixing even more issues +
* Fixes format
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
MessageDeleteBulkPayload,
|
||||
MessageDeletePayload,
|
||||
} from "../../types/mod.ts";
|
||||
import { structures } from "../structures/structures.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalMessageCreate(data: DiscordPayload) {
|
||||
@@ -39,7 +39,7 @@ export async function handleInternalMessageCreate(data: DiscordPayload) {
|
||||
|
||||
const message = await structures.createMessage(payload);
|
||||
// Cache the message
|
||||
cacheHandlers.set("messages", payload.id, message);
|
||||
await cacheHandlers.set("messages", payload.id, message);
|
||||
|
||||
eventHandlers.messageCreate?.(message);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export async function handleInternalMessageDelete(data: DiscordPayload) {
|
||||
await cacheHandlers.get("messages", payload.id),
|
||||
);
|
||||
|
||||
cacheHandlers.delete("messages", payload.id);
|
||||
await cacheHandlers.delete("messages", payload.id);
|
||||
}
|
||||
|
||||
export async function handleInternalMessageDeleteBulk(data: DiscordPayload) {
|
||||
@@ -66,13 +66,13 @@ export async function handleInternalMessageDeleteBulk(data: DiscordPayload) {
|
||||
const channel = await cacheHandlers.get("channels", payload.channel_id);
|
||||
if (!channel) return;
|
||||
|
||||
payload.ids.forEach(async (id) => {
|
||||
return Promise.all(payload.ids.map(async (id) => {
|
||||
eventHandlers.messageDelete?.(
|
||||
{ id, channel },
|
||||
await cacheHandlers.get("messages", id),
|
||||
);
|
||||
cacheHandlers.delete("messages", id);
|
||||
});
|
||||
await cacheHandlers.delete("messages", id);
|
||||
}));
|
||||
}
|
||||
|
||||
export async function handleInternalMessageUpdate(data: DiscordPayload) {
|
||||
|
||||
Reference in New Issue
Block a user