Polarcraft/web/server/api/minecraft/message/chattominecraft.js

11 lines
340 B
JavaScript

export default defineEventHandler(async (event) => {
const { discordId, content } = await readBody(event);
const coll = db.collection('users');
const doc = await coll.findOne({ 'discord.id': discordId });
await sendRconCommand(`tellraw @a {"text":"(DC) ${doc.discord.username} > ${content}"}`)
return { status: 'success' }
});