feat(command): 🔊 add system (non-chat) messages to console log

This includes anything that doesn't return a `.text`.
Such as an `extra`, `translate` or other `json` formatted message.
Ex:
- afk
- errors
- player leave and joins
This commit is contained in:
jay 2021-04-29 08:24:51 +05:00
parent 3686bab167
commit 9f6fea2423

View File

@ -56,6 +56,23 @@ const events = {
}, 15 * 60 * 1000, bot, cfg);
}
}
, message: systemMessage
}
function systemMessage(...args) {
if (args[0]?.text) return
const metadata = (args[0]?.extra || args[0]?.with)?.map(v => v.text)
console.log(
"cmd msg:",
args[0]?.text || args[0]?.translate,
args[0]?.extra?.length || args[0]?.with?.length || Object.keys(args[0]?.json).length - 1,
metadata.length > 0 && metadata || args[0],
args.slice(1)
)
}
function _clientSystemMessage(...args) {
console.log("cmd msg:", args[0]?.message, args[0]?.extra?.length, args[0]?.extra, args[0], args.slice(1))
}
const events_registered = []