From 8a7051a8d6ccb789729e1e09b57e23b6923c2103 Mon Sep 17 00:00:00 2001 From: Ahn Jiwan Date: Mon, 29 Jan 2024 16:12:31 +0900 Subject: [PATCH] :bug: fix: fix access exception --- src/bot/adminMessage.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bot/adminMessage.ts b/src/bot/adminMessage.ts index f614528..1c3219f 100644 --- a/src/bot/adminMessage.ts +++ b/src/bot/adminMessage.ts @@ -10,10 +10,13 @@ export async function sendAdminMessage(message: Message, client: Client) { responseCollector.on('collect', async msg => { const users = await MongoUtil.findAllUser(); - for (let user of users) { - const targetUser = await client.users.fetch(user.discord_id) - await targetUser.send(msg.content); + try{ + const targetUser = await client.users.fetch(user.discord_id) + await targetUser.send(msg.content); + }catch (error){ + logger.error(error); + } } }); responseCollector.on('end', collected => {