Alguém pode me ajudar neste código em JS para um Bot do Discord

Eu posso ter feito o código tudo errado mais pelo o q eu sei devia ter mandado a msg. KSKSKSKKSKSKS
Código:

if(message.author.bot) return;
if(message.channel.type === "dm") return;

const args = message.conten.slice(config.prefix.lenght).trim().split( / +/g);
const comando = args.shift().toLowerCase();

if(comando === “ping”) {
const m = await message.channel.send(“Ping?”);
m.edit(Pong! Ping: ${m.createdTimestamp - message.createdTimestamp}ms. Ping A PI: ${Math.round(client.ping)}ms);
}

Print:

Erro no Terminal do VS Code:

(node:12192) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘slice’ of undefined
at Client. (C:\Users\leopa\OneDrive\Desktop\bot360\bot.js:48:31)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\leopa\OneDrive\Desktop\bot360\node_modules\ws\lib\websocket.js:797:20)
(Use node --trace-warnings ... to show where the warning was created)
(node:12192) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see Command-line options | Node.js v15.0.1 Documentation). (rejection id: 1)
(node:12192) [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.

Print do erro:

Parece que só são erros de ortografia (conten em vez de content, lenght em vez de length), fazendo você acessar propriedades inexistentes (undefined) das coisas.


Tem audiolivro de programação em JS?

2 Curtidas