Improved team system
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ObjectId } from 'mongodb'
|
||||
import jwt from 'jsonwebtoken'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
@@ -48,3 +49,15 @@ export const getAuth = async (event) => {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export const applyUsername = async (user) => {
|
||||
const teamsColl = db.collection('teams')
|
||||
const team = await teamsColl.findOne({ _id: new ObjectId(user.team.id) })
|
||||
|
||||
const discordUsername = user.team ? user.username + ' [' + team.name + ']' : user.discord.username
|
||||
|
||||
await $fetch(config.discordHost + '/user/changenickname', {
|
||||
method: 'POST',
|
||||
body: { nickname: discordUsername, discordId: user.discord.id }
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user