refactor(handlers): move presence/* to misc/* (#677)

This commit is contained in:
ayntee
2021-03-17 16:32:45 +04:00
committed by GitHub
parent eba5679806
commit 489aa6d166
4 changed files with 3 additions and 3 deletions
+19
View File
@@ -0,0 +1,19 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordPayload, UserPayload } from "../../types/mod.ts";
import { cacheHandlers } from "../../cache.ts";
export async function handleUserUpdate(data: DiscordPayload) {
const userData = data.d as UserPayload;
const member = await cacheHandlers.get("members", userData.id);
if (!member) return;
Object.entries(userData).forEach(([key, value]) => {
// @ts-ignore index signatures
if (member[key] !== value) return member[key] = value;
});
await cacheHandlers.set("members", userData.id, member);
eventHandlers.botUpdate?.(userData);
}