(events): update reaction events to use new data model.

This commit is contained in:
2026-08-26 15:13:39 +08:00
parent 8d9acd5d7e
commit cc7788418e
2 changed files with 8 additions and 6 deletions
+4 -3
View File
@@ -1,6 +1,6 @@
import { CommandClient, Constants, Event, Member, Message } from "athena-prime"; import { CommandClient, Constants, Event, Member, Message } from "athena-prime";
import config from '../../config'; import config from '../../config';
import { getUser, setUserXp } from "../../utils"; import { getUser, updateUserStatistics } from "../../utils";
// ---------- // ----------
@@ -12,9 +12,10 @@ class MessageReactionAddEvent extends Event<CommandClient> {
if (msg.author.id !== config.identifiers.targetId || emoji.id !== config.identifiers.emojiId) return; if (msg.author.id !== config.identifiers.targetId || emoji.id !== config.identifiers.emojiId) return;
const _user = await getUser(member.id); const _user = await getUser(member.id);
if (!_user.privacy.optin) return; if (_user.flags.blacklisted || !_user.settings.participating) return;
await setUserXp(_user.user_id, { current: _user.xp.current + 1 }); // Update Statistics.
await updateUserStatistics(member.id, { pets: _user.statistics.pets + 1 });
} }
} }
+4 -3
View File
@@ -1,6 +1,6 @@
import { CommandClient, Constants, Event, Member, Message } from "athena-prime"; import { CommandClient, Constants, Event, Member, Message } from "athena-prime";
import config from '../../config'; import config from '../../config';
import { getUser, setUserXp } from "../../utils"; import { getUser, updateUserStatistics } from "../../utils";
// ---------- // ----------
@@ -12,9 +12,10 @@ class MessageReactionRemoveEvent extends Event<CommandClient> {
if (msg.author.id !== config.identifiers.targetId || emoji.id !== config.identifiers.emojiId) return; if (msg.author.id !== config.identifiers.targetId || emoji.id !== config.identifiers.emojiId) return;
const _user = await getUser(userId); const _user = await getUser(userId);
if (!_user.privacy.optin || _user.xp.current <= 0) return; if (_user.flags.blacklisted || !_user.settings.participating) return;
await setUserXp(_user.user_id, { current: _user.xp.current - 1 }); // Update Statistics.
await updateUserStatistics(userId, { pets: _user.statistics.pets - 1 });
} }
} }