bonk
bonk
SIASapphire - Imagine a framework
Created by Mateleo on 9/6/2023 in #sapphire-support
Issue with pnpm (A type annotation is necessary)
Hey, I wanted to remember you guys that this error still exists 🙂 I switched to yarn for now since the solution mentioned here somehow doesnt work for me
8 replies
SIASapphire - Imagine a framework
Created by bonk on 10/10/2023 in #sapphire-support
OwnerOnly precondition not working
You're welcome! You could also use the CLI, generate a new project and just put your stuff in there, this works too. I don't really exactly know what the issue is but yeah. 🙂
10 replies
SIASapphire - Imagine a framework
Created by bonk on 10/10/2023 in #sapphire-support
OwnerOnly precondition not working
@nonsensetwice
10 replies
SIASapphire - Imagine a framework
Created by bonk on 10/10/2023 in #sapphire-support
OwnerOnly precondition not working
After i made the failure messages work it said the "OwnerOnly" is unavailable, so I tried renaming the file, etc. and then it just worked for some reason. Also i checked some repos linked here under tag how they made their BotOwner precondition. https://github.com/SpecteraLabs/Spectera/blob/main/src/preconditions/BotOwner.ts https://github.com/SpecteraLabs/Spectera/blob/main/src/listeners/commands/chatInputCommandDenied.ts This made it work for me (thank you Spectera if you read this somehow). It could also work with the precondition in the guide by renaming it to smth like "BotOwner", I didn't try that
10 replies
SIASapphire - Imagine a framework
Created by bonk on 10/10/2023 in #sapphire-support
OwnerOnly precondition not working
fixed it
10 replies
SIASapphire - Imagine a framework
Created by bonk on 10/10/2023 in #sapphire-support
OwnerOnly precondition not working
Da command
import { Command, type ApplicationCommandRegistry } from '@sapphire/framework';
import { type ChatInputCommandInteraction } from 'discord.js';
import { ApplyOptions } from '@sapphire/decorators';

@ApplyOptions<Command.Options>({
name: 'restart',
description: 'Restarts the bot',
preconditions: ["OwnerOnly"]
})
export class RestartCommand extends Command {
public override registerApplicationCommands(
registry: ApplicationCommandRegistry
) {
registry.registerChatInputCommand((command) => {
command.setName(this.name).setDescription(this.description);
});
}

public async chatInputRun(interaction: ChatInputCommandInteraction) {
await interaction.reply({
content: 'Restarting...',
ephemeral: true,
});

await this.container.client.destroy();
await this.container.client.login(process.env.BOT_TOKEN);
}
}
import { Command, type ApplicationCommandRegistry } from '@sapphire/framework';
import { type ChatInputCommandInteraction } from 'discord.js';
import { ApplyOptions } from '@sapphire/decorators';

@ApplyOptions<Command.Options>({
name: 'restart',
description: 'Restarts the bot',
preconditions: ["OwnerOnly"]
})
export class RestartCommand extends Command {
public override registerApplicationCommands(
registry: ApplicationCommandRegistry
) {
registry.registerChatInputCommand((command) => {
command.setName(this.name).setDescription(this.description);
});
}

public async chatInputRun(interaction: ChatInputCommandInteraction) {
await interaction.reply({
content: 'Restarting...',
ephemeral: true,
});

await this.container.client.destroy();
await this.container.client.login(process.env.BOT_TOKEN);
}
}
10 replies