abe
abe
Explore posts from servers
SIASapphire - Imagine a framework
Created by abe on 11/26/2023 in #sapphire-support
Run bot without building to js and use ts-node or other alternatives instead.
Is there a way to achieve the title? Currently I need to build and then run the js file using the command:
npm run build && npm run start
npm run build && npm run start
14 replies
SIASapphire - Imagine a framework
Created by abe on 10/17/2023 in #sapphire-support
How can I remove a subcommand check?
No description
4 replies
Command `admin.ts` not being registered in the command registry
This is the error message I am receiving when I run the bot: Encountered error while handling the command application command registry for command "admin" at path "~/dist/commands/admin.js" ExpectedConstraintError > s.string.lengthGreaterThanOrEqual this is what the admin.ts looks like:
ApplyOptions<Command.Options>({
name: 'admin',
description: 'Admin-only commands.'
})
export class AdminCommand extends Command { /* ... */ };
ApplyOptions<Command.Options>({
name: 'admin',
description: 'Admin-only commands.'
})
export class AdminCommand extends Command { /* ... */ };
6 replies
Listener with `once: true` appears to be triggering multiple times
import { ApplyOptions } from '@sapphire/decorators';
import { Events, Listener } from '@sapphire/framework';
import { ChannelType } from 'discord.js';
import { DBMessageLogs } from '../lib/database/DBMessageLogs';

@ApplyOptions<Listener.Options>({ once: true, event: Events.ClientReady })
export class ReadyMessageLogsDBListener extends Listener {
public override async run() {
const { client, database } = this.container;
const guilds = client.guilds.cache.map(g => g.id);

guilds.forEach(guild_id => {
const guild = client.guilds.cache.get(guild_id);
const channelsCollection = guild?.channels.cache;

if (!channelsCollection) {
return;
}

const channels = [...channelsCollection.values()]
.filter(channel => channel.type === ChannelType.GuildText);

let logDB = new DBMessageLogs(database);
channels.forEach(async (channel) => {
console.log(`ADDING CHANNEL NAME ${channel.name} with ID ${channel.id}`);
await logDB.channelAdd(BigInt(channel.id), channel.name, BigInt(guild.id));
});
})
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { Events, Listener } from '@sapphire/framework';
import { ChannelType } from 'discord.js';
import { DBMessageLogs } from '../lib/database/DBMessageLogs';

@ApplyOptions<Listener.Options>({ once: true, event: Events.ClientReady })
export class ReadyMessageLogsDBListener extends Listener {
public override async run() {
const { client, database } = this.container;
const guilds = client.guilds.cache.map(g => g.id);

guilds.forEach(guild_id => {
const guild = client.guilds.cache.get(guild_id);
const channelsCollection = guild?.channels.cache;

if (!channelsCollection) {
return;
}

const channels = [...channelsCollection.values()]
.filter(channel => channel.type === ChannelType.GuildText);

let logDB = new DBMessageLogs(database);
channels.forEach(async (channel) => {
console.log(`ADDING CHANNEL NAME ${channel.name} with ID ${channel.id}`);
await logDB.channelAdd(BigInt(channel.id), channel.name, BigInt(guild.id));
});
})
}
}
51 replies
remove command from command registry after renaming a command file
No description
5 replies
Build sapphirejs typescript project?
I'm new to sapphire and I am following the official guide on the website. However it only shows a file structure of JavaScript files. How can I set up the project to build using tsc?
7 replies