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
master
jay 3 years ago
parent 3686bab167
commit 9f6fea2423
  1. 17
      lib/plugins/command.js

@ -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 = []

Loading…
Cancel
Save