nodejs.org
nodejs.org
Explore posts from servers
SIASapphire - Imagine a framework
Created by nodejs.org on 1/29/2023 in #sapphire-support
not working
Hi, my bot is not working does anyone know why? index.ts:
import { SapphireClient } from '@sapphire/framework';
import { GatewayIntentBits } from 'discord.js';

(async () => await (new SapphireClient({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],

defaultPrefix: '?',

caseInsensitiveCommands: true,
loadMessageCommandListeners: true,
})).login('TOKEN'))();
import { SapphireClient } from '@sapphire/framework';
import { GatewayIntentBits } from 'discord.js';

(async () => await (new SapphireClient({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],

defaultPrefix: '?',

caseInsensitiveCommands: true,
loadMessageCommandListeners: true,
})).login('TOKEN'))();
commands/ping.ts:
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class UserCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, { ...options,
aliases: [
'pong',
],

name: 'ping',
});
};

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

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 UserCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, { ...options,
aliases: [
'pong',
],

name: 'ping',
});
};

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

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);
}
};
21 replies