confused

when i make the file extension to js it gives me 5 error and says the file should be in TS extension which i did but when i follow the guide now it gives me a new error
7 Replies
Favna
Favna12mo ago
} is expected. You're missing a closing brace for an object or similar.
Spinel
Spinel12mo ago
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics: - Read and understand docs - Debug code - Syntax - NodeJS module system If you aren't sure that your understanding of JavaScript is truly good enough to make a bot, you should really try to continue learning first. Here are good resources to learn both Javascript and NodeJS: Codecademy: https://www.codecademy.com/learn/javascript Udemy: https://www.udemy.com/javascript-essentials/ Eloquent JavaScript, free book: http://eloquentjavascript.net/ You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS JavaScript Garden: https://bonsaiden.github.io/JavaScript-Garden/ JavaScript reference/docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference Nodeschool: https://nodeschool.io/ Pluralsight: https://www.codeschool.com/courses/real-time-web-with-node-js Before you ask a question, you should ask these yourself: 1) Is this question related to JavaScript, or the library I am using? - If it is the library you are using, go to the proper server. You would get better answers there. 2) Have I tried to google and / or check StackOverflow? - Double check that you can't find anywhere that can lead you to a solution online. 3) Have I tried to look on MDN or the library documentation? - You should always check documentations to make sure you aren't missing how any details. 4) Does my question make enough sense so that people can understand it, and do they understand what I am trying to accomplish? - If no, revise your question. Give as much detail as possible. Include any error or code output that can help us help you. 5) Am I aware of what I am doing, and not just mindlessly copy and pasting? - If you are just copy and pasting code from a guide, you are not going to be able to solve anything. Make sure you understand the code you are writing.
Vanilla
Vanilla12mo ago
ik I have been looking for it since forever I couldn't find it
Favna
Favna12mo ago
Well if you expect us to tell you where without showing the code you got the wrong idea pepeDaheck
Vanilla
Vanilla12mo ago
it's the ping cmd from guide kekw turn on my laptop gimme a sec
Favna
Favna12mo ago
Then git stage your changes and copy the guide code again and then you will be able to see the difference. You'd do well to learn some basic problem analysis like that
Vanilla
Vanilla12mo ago
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class PingCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
}

public async messageRun(message: Message) {
const msg = await message.channel.send('Ping?');

const content = `Pong from JavaScript! Bot Latency ${Math.round(this.container.client.ws.ping)}ms. API Latency ${
msg.createdTimestamp - message.createdTimestamp
}ms.`;

return msg.edit(content);
}
}
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class PingCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
}

public async messageRun(message: Message) {
const msg = await message.channel.send('Ping?');

const content = `Pong from JavaScript! Bot Latency ${Math.round(this.container.client.ws.ping)}ms. API Latency ${
msg.createdTimestamp - message.createdTimestamp
}ms.`;

return msg.edit(content);
}
}
sure
Want results from more Discord servers?
Add your server
More Posts