Ravelt
Ravelt
SIASapphire - Imagine a framework
Created by Ravelt on 2/13/2024 in #discordjs-support
User object roles
If a user uses a slash command, is there a guarantee the member object I receive in the handler would be the latest update of that member? I had assumed that would be the case but I'm having behaviour that would suggest the member object I receive does not have the latest up to date information on what roles the user has.
11 replies
SIASapphire - Imagine a framework
Created by Ravelt on 1/7/2024 in #sapphire-support
sapphire cli not working
No description
8 replies
SIASapphire - Imagine a framework
Created by Ravelt on 1/3/2024 in #sapphire-support
Slash command not updated
No description
33 replies
SIASapphire - Imagine a framework
Created by Ravelt on 12/29/2023 in #sapphire-support
The precondition "SubcommandCooldown" is not available.
Hi, I have cooldowns configured on a subcommand like so, but running the command gives the title error.
25 replies
SIASapphire - Imagine a framework
Created by Ravelt on 12/27/2023 in #sapphire-support
Subcommand Organization
I'm switching back to the sapphire subcommand plugin from kanames since it's not updated and I'm running into a minor issue I'm not sure how to solve. With the sapphire subcommand plugin all subcommands in a single top level subcommand are supposed to have the chatinputrun methods defined in the same file. This makes my subcommand files very long and hard to get to the code for individual commands. I've tried putting the logic for the commands in their own file, but then I get "Error [EMPTY_MODULE]: A compatible class export was not found" for files that define command logic but not the commands themselves because I have them grouped together in the commands folder like in the attached image. The game_parent file is where the command registration is and the chatinput run methods there call methods from guess/whack etc to perform command logic. I can move them to somewhere not under commands folder but I'd like to keep them all the logic together so it's not confusing. Is there a better way to do this?
11 replies
SIASapphire - Imagine a framework
Created by Ravelt on 12/26/2023 in #sapphire-support
Argument of type 'Context' is not assignable to parameter of type 'LoaderContext
Hi, I am getting above error in various files when deploying on production after upgrading my ts-config from 4.00 to 5.00. I do not get it when building the docker image on my local machine. Any ideas how that discrepancy would happen?
16 replies
SIASapphire - Imagine a framework
Created by Ravelt on 10/18/2023 in #discordjs-support
Does ChannelType.GuildText includes categories?
I have a slash command with channel input that I filter to ChannelType.GuildText, but if you search for a category name it will come up in the pop up. Leads to weird behavior since a category is invalid input for the command. I can check for this explicitly in my logic but it seems weird categories show up at all since I would add ChannelType.GuildCategory if I wanted that
5 replies
SIASapphire - Imagine a framework
Created by Ravelt on 9/2/2023 in #discordjs-support
Categories cannot have subcategories api error
Got this error:
DiscordAPIError[50035]: Invalid Form Body
parent_id[CHANNEL_PARENT_INVALID_PARENT]: Categories cannot have subcategories
DiscordAPIError[50035]: Invalid Form Body
parent_id[CHANNEL_PARENT_INVALID_PARENT]: Categories cannot have subcategories
the other day with a command that moves a channel to another category. Really confused what it means by subcategories here or how this error could come about so seeking advice. Or what could constitute an invalid channel parent? In my slash command I filter the category option with ChannelType.GuildCategory
5 replies
SIASapphire - Imagine a framework
Created by Ravelt on 7/3/2023 in #discordjs-support
Potential mass api usage issues
I have a moderation bot of a sort, and in my use case I have a lot of commands that might do something at a scale maybe out of normal from other bots. For example, create 50 channels at once, send a message to 500 channels at once, modify the permissions of 50 channels at once, delete 5000 messages at once. At once meaning like sequentially but in one command. I'm using sapphire so in theory I should be fine rate limit wise but is there anything I should look out for or avoid doing that discord might have issues with? And especially at scale with it in multiple servers, not sure what would happen if the bot were in 50 servers trying to delete 5k messages each. I haven't had any issues for the past few years with the pretty small amount of servers it's in but I've been refactoring it to scale and want to be prepared before I verify it.
3 replies
SIASapphire - Imagine a framework
Created by Ravelt on 5/10/2023 in #discordjs-support
What is cached?
I can't seem to find a solid answer for this, what is always cached by discord js on startup and what needs to be fetched? Right now my understanding is guilds and channels are always cached, while members should be fetched always. Not sure about roles
12 replies
SIASapphire - Imagine a framework
Created by Ravelt on 1/24/2023 in #sapphire-support
Handle Crash on DiscordAPIError[50001]: Missing Access
The scenario that causes this crash is the bot tries sending a message to a channel it doesn't have access to. Now I can solve this issue by checking it has permissions before hand or catching directly on the send, but my question is, is there a way to keep the bot from crashing if I miss a check at some other point? I do have an error.ts listener set up but doesn't seem to be making a difference.
/Users/x/Work/bot/node_modules/@discordjs/rest/dist/index.js:667
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50001]: Missing Access
/Users/x/Work/bot/node_modules/@discordjs/rest/dist/index.js:667
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50001]: Missing Access
error.ts
import { ApplyOptions } from '@sapphire/decorators';
import { Events, Listener } from '@sapphire/framework';

@ApplyOptions<Listener.Options>({
event: Events.Error,
name: 'Error'
})
export class UserEvent extends Listener {

public run(error: Error) {

const { logger } = this.container;
logger.error(error);

return;
}

}
import { ApplyOptions } from '@sapphire/decorators';
import { Events, Listener } from '@sapphire/framework';

@ApplyOptions<Listener.Options>({
event: Events.Error,
name: 'Error'
})
export class UserEvent extends Listener {

public run(error: Error) {

const { logger } = this.container;
logger.error(error);

return;
}

}
4 replies
SIASapphire - Imagine a framework
Created by Ravelt on 1/21/2023 in #discordjs-support
Variable slash command argument parsing
Is it possible to have slash commands with a variable amount of arguments, up to perhaps 20? If not I think I will parse a string but wanted to check if there's a batter way to do this.
11 replies
SIASapphire - Imagine a framework
Created by Ravelt on 1/21/2023 in #sapphire-support
Quoted argument not consumed as single argument
5 replies