mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-18 08:43:57 +00:00
fix(bots/discord): more logging during apply role preset on member join
It seems to keep skipping some members for some reason...
This commit is contained in:
@@ -2,6 +2,7 @@ import { and, eq, gt } from 'drizzle-orm'
|
|||||||
import { appliedPresets } from '$/database/schemas'
|
import { appliedPresets } from '$/database/schemas'
|
||||||
import { on, withContext } from '$/utils/discord/events'
|
import { on, withContext } from '$/utils/discord/events'
|
||||||
import { applyRolesUsingPreset } from '$/utils/discord/rolePresets'
|
import { applyRolesUsingPreset } from '$/utils/discord/rolePresets'
|
||||||
|
import { logger } from '$/context'
|
||||||
|
|
||||||
withContext(on, 'guildMemberAdd', async ({ database }, member) => {
|
withContext(on, 'guildMemberAdd', async ({ database }, member) => {
|
||||||
const applieds = await database.query.appliedPresets.findMany({
|
const applieds = await database.query.appliedPresets.findMany({
|
||||||
@@ -12,5 +13,12 @@ withContext(on, 'guildMemberAdd', async ({ database }, member) => {
|
|||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!applieds.length) return
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
`Re-applying role presets for member ${member.id} in guild ${member.guild.id}:`,
|
||||||
|
applieds.map(x => x.preset),
|
||||||
|
)
|
||||||
|
|
||||||
for (const { preset } of applieds) await applyRolesUsingPreset(preset, member)
|
for (const { preset } of applieds) await applyRolesUsingPreset(preset, member)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user