After struggling for days, I am reaching out for help as I encounter a null error and difficulty changing the time format in my code below. Despite my efforts, this issue seems unsolvable.
Error #1 ------------------------------
(node:8844) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of null
at Object.execute (C:\filepath\bot\commands\serverinfo.js:22:39)
...
(node:8844) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The main problem lies in extracting the server name for a DM. How can I modify the code to separate the DM portion from the channel portion effectively?
Error #2 ------------------------------
In an attempt to shorten the time and date format, I am facing challenges. The current output is lengthy, while I aim to achieve a simpler MM/DD/YYYY format without success using moment.js.
If you have the solution to assist me, I would deeply appreciate it.
CODE -------------
const { prefix } = require('../config.json');
module.exports = {
name: 'serverinfo',
description: 'sends the serverinfo command',
...
}