savageđź—ˇ
savageđź—ˇ
Explore posts from servers
SIASapphire - Imagine a framework
Created by savageđź—ˇ on 1/16/2023 in #sapphire-support
Using Typescript in Sapphire.
I was changing between Javascript to Typescript in the framework, and ping command don't work. My code: ping.ts
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';
export class PingCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, {
...options,
name: 'ping',
aliases: ['pong'],
description: 'ping pong'
});
}
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) {
super(context, {
...options,
name: 'ping',
aliases: ['pong'],
description: 'ping pong'
});
}
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);
}
}
index.js
import { SapphireClient } from '@sapphire/framework';

const client = new SapphireClient({
defaultPrefix: "-",
caseInsensitiveCommands: true,
loadMessageCommandListeners: true,
intents: 8705
});

async function runBot() {
await client.login('');
console.log("Bot | Online");
}
runBot();
import { SapphireClient } from '@sapphire/framework';

const client = new SapphireClient({
defaultPrefix: "-",
caseInsensitiveCommands: true,
loadMessageCommandListeners: true,
intents: 8705
});

async function runBot() {
await client.login('');
console.log("Bot | Online");
}
runBot();
7 replies
SIASapphire - Imagine a framework
Created by savageđź—ˇ on 1/3/2023 in #sapphire-support
BOT don't catch commands
my bot don't catch commands, what i try to mean is that when i use for example: -ping command it doesn't say anything, i don't know what i'm doing BAD 'cause i'm watching a video, can someone help me? please <:clown_sob:765318460241870920> index.js
const { SapphireClient } = require("@sapphire/framework");

const bot = new SapphireClient({
defaultPrefix: "-",
caseInsensitiveCommands: true,
intents: [
'GUILDS','GUILD_MEMBERS','GUILD_BANS','GUILD_EMOJIS_AND_STICKERS','GUILD_VOICE_STATES','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS','DIRECT_MESSAGES','DIRECT_MESSAGE_REACTIONS'
]
});

async function main() {
await bot.login("");
bot.user.setActivity("Bot");
console.log("Ready!")
}

main()
const { SapphireClient } = require("@sapphire/framework");

const bot = new SapphireClient({
defaultPrefix: "-",
caseInsensitiveCommands: true,
intents: [
'GUILDS','GUILD_MEMBERS','GUILD_BANS','GUILD_EMOJIS_AND_STICKERS','GUILD_VOICE_STATES','GUILD_MESSAGES','GUILD_MESSAGE_REACTIONS','DIRECT_MESSAGES','DIRECT_MESSAGE_REACTIONS'
]
});

async function main() {
await bot.login("");
bot.user.setActivity("Bot");
console.log("Ready!")
}

main()
"@sapphire/framework": "^3.1.4", "discord.js": "^13.12.0"
ping.js
const { Command } = require('@sapphire/framework');
class PingCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: 'ping',
aliases: ['pong'],
description: 'ping pong'
});
}
async messageRun(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);
}
}
module.exports = {
PingCommand
};
const { Command } = require('@sapphire/framework');
class PingCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: 'ping',
aliases: ['pong'],
description: 'ping pong'
});
}
async messageRun(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);
}
}
module.exports = {
PingCommand
};
someone help me asap please! i don't know what i'm doing bad :/
9 replies