weird bug/error

idk why or how but like
58 Replies
Lioness100
Lioness10011mo ago
word 👍
untitled.
untitled.11mo ago
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class HelpCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, {
...options,
name: 'help',
aliases: ['h'],
description: 'the help command'
});
}

public async messageRun(message: Message) {
message.channel.send('This is a fun command!');
}
}

declare module '@sapphire/framework' {
interface Command {
HelpCommand: never;
}
}
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class HelpCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, {
...options,
name: 'help',
aliases: ['h'],
description: 'the help command'
});
}

public async messageRun(message: Message) {
message.channel.send('This is a fun command!');
}
}

declare module '@sapphire/framework' {
interface Command {
HelpCommand: never;
}
}
I HAVE THIS COMMAND i made thsi but it doesn't detect the command
untitled.
untitled.11mo ago
it doesn't yap @Lioness100 look
No description
untitled.
untitled.11mo ago
no response no errors on command line
Spinel
Spinel11mo ago
Our experience in Klasa, and according to many Akairo users is that built-in help commands suck, and everyone customises them. Furthermore, having built-in commands force you to add extra logic in your code (specifically everywhere that reads custom properties from commands), so if you rely on a property to exist, because it does in your commands, it'll break easily with built-in ones unless you overwrite them. A help command is even worse, they give special constraints that shouldn't exist and can be implemented as you desire. There's also the people who want to only show specific commands, a list of all commands in one embed, paginated commands, paginated lists of commands (based on categories), and all of that can be in either plain text, inside codeblocks (and from there, many syntaxes and formats), or embeds. And to take things further, there are people who simply want to show all commands, and people who show only the commands they can use. And so far we have only covered message based commands. Chat input commands are a whole different beast, because they have native descriptions and if you do have a /help for more details that could use autocomplete to fill out the command name. If you take all the different ways to format commands, you end up with hundreds or thousands of different possibilities. It is not possible for us to deliver a help command that complies to all those possibilities. Therefore, everyone will eventually replace the built-in one with their own, so why take the effort?
Lioness100
Lioness10011mo ago
yo wrong one sorry
Spinel
Spinel11mo ago
When asking for help, make sure to provide as much detail as possible. What have you tried so far? Do you have stacktraces that you can show us? What are you trying to achieve? Try to answer these questions and others, so we do not have to ask for them afterwards.
❯ For a good guide on how to ask questions, see the instructions that StackOverflow gives. You should try to always follow these guidelines. ❯ For an excellent video that shows how not to ask technical questions is this, watch this YouTube video by LiveOverflow. ❯ Asking technical questions (Clarkson)How to ask questions the smart way (Raymond)
Lioness100
Lioness10011mo ago
also wrong one ugh
untitled.
untitled.11mo ago
im making a prefix command
import { SapphireClient } from "@sapphire/framework";
import 'dotenv/config'
const token = process.env.TOKEN;


const client = new SapphireClient({
intents: ['Guilds', 'GuildMessages'],
defaultPrefix: ','
});

client.login(token)
import { SapphireClient } from "@sapphire/framework";
import 'dotenv/config'
const token = process.env.TOKEN;


const client = new SapphireClient({
intents: ['Guilds', 'GuildMessages'],
defaultPrefix: ','
});

client.login(token)
this is my main.ts
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class HelpCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, {
...options,
name: 'help',
aliases: ['h'],
description: 'the help command'
});
}

public async messageRun(message: Message) {
message.channel.send('This is a fun command!');
}
}

declare module '@sapphire/framework' {
interface Command {
HelpCommand: never;
}
}
import { Command } from '@sapphire/framework';
import type { Message } from 'discord.js';

export class HelpCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, {
...options,
name: 'help',
aliases: ['h'],
description: 'the help command'
});
}

public async messageRun(message: Message) {
message.channel.send('This is a fun command!');
}
}

declare module '@sapphire/framework' {
interface Command {
HelpCommand: never;
}
}
/commands/info/help.ts
Lioness100
Lioness10011mo ago
If your prefix is , then you should be trying ,help, not $help?
untitled.
untitled.11mo ago
yea i tried that i changed prefix aftert
untitled.
untitled.11mo ago
No description
Lioness100
Lioness10011mo ago
Just fyi this isn't necessary
declare module '@sapphire/framework' {
interface Command {
HelpCommand: never;
}
}
declare module '@sapphire/framework' {
interface Command {
HelpCommand: never;
}
}
That's only for preconditions
untitled.
untitled.11mo ago
what r preconditions i used gpt4 to generate all this code
Lioness100
Lioness10011mo ago
Oh you forgot the MessageContent intent
untitled.
untitled.11mo ago
ohhh word? does it autodetect my handler or do i needa write a handler
Lioness100
Lioness10011mo ago
Also add loadMessageCommandListeners: true to your client options
untitled.
untitled.11mo ago
or do it detects my commands
Lioness100
Lioness10011mo ago
It will detect your commands I'd recommend just checking out the guide https://www.sapphirejs.dev/docs/Guide/getting-started/getting-started-with-sapphire, but to make the changes I just listed, your main.ts would look like:
const client = new SapphireClient({
intents: ['Guilds', 'GuildMessages', 'MessageContent'],
defaultPrefix: ',',
loadMessageCommandListeners: true
});
const client = new SapphireClient({
intents: ['Guilds', 'GuildMessages', 'MessageContent'],
defaultPrefix: ',',
loadMessageCommandListeners: true
});
Favna
Favna11mo ago
Please read our user guide at https://www.sapphirejs.dev/
Sapphire Framework
Home | Sapphire
Sapphire is a next-gen Discord bot framework for developers of all skill levels to make the best JavaScript/TypeScript based bots possible.
untitled.
untitled.11mo ago
can i customize this logger yall gave me? i did this didn't work
Lioness100
Lioness10011mo ago
What's your main field in the package.json?
untitled.
untitled.11mo ago
why's that needed
{
"dependencies": {
"@sapphire/framework": "^5.0.4",
"discord.js": "^14.14.1",
"dotenv": "^16.3.1"
}
}
{
"dependencies": {
"@sapphire/framework": "^5.0.4",
"discord.js": "^14.14.1",
"dotenv": "^16.3.1"
}
}
my package.json
Lioness100
Lioness10011mo ago
No description
Lioness100
Lioness10011mo ago
I recommend you read the documentation Just the first few pages at least
Favna
Favna11mo ago
Hai mom I'm in Lioness' screenshots
untitled.
untitled.11mo ago
funne
Favna
Favna11mo ago
I know right, I'm a comedic genius.
untitled.
untitled.11mo ago
last question why is my typescript being weird
untitled.
untitled.11mo ago
No description
untitled.
untitled.11mo ago
it says iconurl has to be a string but i tried putting message.author.avatarURL it didn't work i tried message.author.displayAvatarURL message.author.avatarURL and that ternary operator too
Lioness100
Lioness10011mo ago
I think avatarURL is nullable. I'd use displayAvatarURL, but make sure you're invoking it because it's a function not a property That ternary operator is useless because message.author will always be there. You might've meant message.author.avatarURL ?? '...', which will also work Because it will default to the string if the user doesn't have an avatar
untitled.
untitled.11mo ago
thanks
No description
Lioness100
Lioness10011mo ago
👍
untitled.
untitled.11mo ago
can i customise this logger
Lioness100
Lioness10011mo ago
Yes, the client options have a logger field. You can either set the logger level or add your own logger instance (it just needs to implement ILogger) or use @sapphire/plugin-logger for a pretty one
untitled.
untitled.11mo ago
why did you edit that 8 times
Lioness100
Lioness10011mo ago
for fun
untitled.
untitled.11mo ago
i thought you wrote a whole essay
No description
Lioness100
Lioness10011mo ago
haha
untitled.
untitled.11mo ago
that's amazing. hey, a design related question where would you put your database files in a bot i have a /src folder which everything is inside that. do make a folder called db? or what?
Lioness100
Lioness10011mo ago
What are the database files? Like, the actual data? Or schemas/similar?
untitled.
untitled.11mo ago
schema's schemas
Lioness100
Lioness10011mo ago
what database are you using
untitled.
untitled.11mo ago
connection file mongo
import mongoose, { Document, Schema } from 'mongoose';


interface ILstfm extends Document {
userId: string;
username: string;
}

const lstfmSchema: Schema = new Schema({
userId: { type: String, required: true },
username: { type: String, required: true }
});


const Lstfm = mongoose.model<ILstfm>('Lstfm', lstfmSchema);

export { Lstfm, ILstfm };
import mongoose, { Document, Schema } from 'mongoose';


interface ILstfm extends Document {
userId: string;
username: string;
}

const lstfmSchema: Schema = new Schema({
userId: { type: String, required: true },
username: { type: String, required: true }
});


const Lstfm = mongoose.model<ILstfm>('Lstfm', lstfmSchema);

export { Lstfm, ILstfm };
Lioness100
Lioness10011mo ago
I might be off mark but iirc the standard is putting it in a models/ folder
untitled.
untitled.11mo ago
models? isn't that a schema? ho no
Lioness100
Lioness10011mo ago
buddy
No description
untitled.
untitled.11mo ago
yup models my bad
Lioness100
Lioness10011mo ago
also wanted to plug https://typegoose.github.io/ in case you're interested although if this is all you're storing then dont fix what isn't blobfingerguns
untitled.
untitled.11mo ago
im just making myself an assistant for lastfm tbh
Favna
Favna11mo ago
Prisma tho
untitled.
untitled.11mo ago
nah cuh
Lioness100
Lioness10011mo ago
my thought exactly
untitled.
untitled.11mo ago
where can i find the name of all evens events?
untitled.
untitled.11mo ago
hey @Favna is there a way to get all of the commands?
Favna
Favna11mo ago
https://discord.com/channels/737141877803057244/737142209639350343/1151595641307414579 Also please create new threads for new questions so we can properly use @Answer Overflow Closing this to prevent further derailment
Want results from more Discord servers?
Add your server