Skip to content

Commit

Permalink
🐛 fix: fix access exception
Browse files Browse the repository at this point in the history
  • Loading branch information
synoti21 committed Jan 29, 2024
1 parent cf4116e commit 8a7051a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/bot/adminMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 8a7051a

Please sign in to comment.