19 lines
499 B
JavaScript
19 lines
499 B
JavaScript
|
export default defineEventHandler(async (event) => {
|
||
|
const { content, uuid } = await readBody(event);
|
||
|
|
||
|
const config = useRuntimeConfig();
|
||
|
|
||
|
const coll = db.collection('users')
|
||
|
const doc = await coll.findOne({ 'minecraft.uuid': uuid })
|
||
|
|
||
|
await $fetch(config.discordHost + '/minecraft/sendgamemessage', {
|
||
|
method: 'POST',
|
||
|
body: {
|
||
|
avatarURL: 'https://api.mineatar.io/face/' + doc.minecraft.uuid + '?scale=16',
|
||
|
content: content,
|
||
|
}
|
||
|
})
|
||
|
|
||
|
return { code: 'success' }
|
||
|
});
|