mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-20 16:25:03 +00:00
refactor: Shorten number of DB queries
This commit is contained in:
parent
e6ae893f26
commit
56fcf1d1e7
1 changed files with 2 additions and 3 deletions
|
@ -9,9 +9,8 @@ export const AFKNotificationEvt = afkEvt({
|
|||
if (message.mentions.length) {
|
||||
const mentionedMembers: Array<{ id: string, status: string }> = [];
|
||||
for (const user of message.mentions) {
|
||||
const isAfk = await pluginData.state.afkUsers.isAfk(user.id);
|
||||
if (isAfk) {
|
||||
const afk = (await pluginData.state.afkUsers.getUserAFKStatus(user.id))!;
|
||||
if (afk) {
|
||||
mentionedMembers.push({
|
||||
id: afk.user_id,
|
||||
status: afk.status,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue