diff --git a/src/server/plugins/discord.ts b/src/server/plugins/discord.ts index f584491f..f2dce66d 100644 --- a/src/server/plugins/discord.ts +++ b/src/server/plugins/discord.ts @@ -89,7 +89,9 @@ export default defineNitroPlugin(async (app) => { if (user && existingUser.vatsim) { await user.roles.add(discordRoleId); - await user.setNickname(`${ existingUser.vatsim.fullName } ${ existingUser.vatsim.id }`, 'Verification process'); + if (!user.permissions.has(PermissionFlagsBits.Administrator)) { + await user.setNickname(`${ existingUser.vatsim.fullName } ${ existingUser.vatsim.id }`, 'Verification process'); + } } } else { diff --git a/src/server/routes/auth/vatsim/index.ts b/src/server/routes/auth/vatsim/index.ts index b76d34d0..0cc178fc 100644 --- a/src/server/routes/auth/vatsim/index.ts +++ b/src/server/routes/auth/vatsim/index.ts @@ -4,6 +4,7 @@ import { createDBUser, getDBUserToken } from '~/utils/db/user'; import { vatsimAuthOrRefresh, vatsimGetUser } from '~/utils/backend/vatsim'; import { findUserByCookie } from '~/utils/backend/user'; import { discordClient, discordRoleId, discordServerId } from '~/server/plugins/discord'; +import { PermissionFlagsBits } from 'discord.js'; export default defineEventHandler(async (event) => { try { @@ -57,7 +58,9 @@ export default defineEventHandler(async (event) => { const user = await (await discordClient.guilds.fetch(discordServerId)).members.fetch(discordId); if (user) { await user.roles.add(discordRoleId); - await user.setNickname(`${ vatsimUser.personal.name_full } ${ vatsimUser.cid }`, 'Verification process'); + if (!user.permissions.has(PermissionFlagsBits.Administrator)) { + await user.setNickname(`${ vatsimUser.personal.name_full } ${ vatsimUser.cid }`, 'Verification process'); + } } }