Bejasc
Bejasc
Explore posts from servers
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
thanks for letting me bounce off you, appreciate the quick response 🙏
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
I'll likely migrate over to that and refer to your above message
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
I may not even need to use nodemon - scaffolded from something else, my other prod package is using this as it's dev command "dev": "tsc-watch --onSuccess \"node --enable-source-maps ./dist/Bot.js\" ", Which has worked well
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
thankyou mate - I compared it to my other bot that was running in prod and then it jumped at me - I must've scaffolded this package from something different
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
hah! changed it to dist/Bot.js - fixed it. I missed that 😓
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
4 - nothing set directly for module - but entire package.json listed above
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
package.json
{
"name": "@australis/bot",
"version": "1.0.0",
"description": "SC-Australis Bot",
"author": "Bejasc (https://github.com/bejasc)",
"main": "src/Bot.ts",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"start": "node dist/Bot.js",
"dev": "nodemon src/Bot.ts",
"format": "prettier --write \"src/**/*.ts\""
},
"dependencies": {
"@australis/types": "workspace:^",
"@bejasc/helpers": "workspace:^",
"@bejasc/logger": "workspace:^",
"@sapphire/decorators": "^6.1.0",
"@sapphire/framework": "^5.2.1",
"@sapphire/plugin-subcommands": "^7.0.0",
"axios": "^1.2.1",
"discord.js": "^14.16.3",
"tsc-watch": "^6.2.0",
"typescript": "^5.6.2"
},
"installConfig": {
"hoistingLimits": "workspaces"
}
}
{
"name": "@australis/bot",
"version": "1.0.0",
"description": "SC-Australis Bot",
"author": "Bejasc (https://github.com/bejasc)",
"main": "src/Bot.ts",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"start": "node dist/Bot.js",
"dev": "nodemon src/Bot.ts",
"format": "prettier --write \"src/**/*.ts\""
},
"dependencies": {
"@australis/types": "workspace:^",
"@bejasc/helpers": "workspace:^",
"@bejasc/logger": "workspace:^",
"@sapphire/decorators": "^6.1.0",
"@sapphire/framework": "^5.2.1",
"@sapphire/plugin-subcommands": "^7.0.0",
"axios": "^1.2.1",
"discord.js": "^14.16.3",
"tsc-watch": "^6.2.0",
"typescript": "^5.6.2"
},
"installConfig": {
"hoistingLimits": "workspaces"
}
}
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
No description
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 12/4/2024 in #sapphire-support
Difference with dev and prod > The application now has 0 global commands
Hey fav, thanks for taking a look 👋
19 replies
SIASapphire - Imagine a framework
Created by Bejasc on 11/2/2024 in #sapphire-support
Precondition not running
declare module "@sapphire/framework" {
interface Preconditions {
OwnerOnly: never;
}
}
declare module "@sapphire/framework" {
interface Preconditions {
OwnerOnly: never;
}
}
File name has to match this The file the precondition was stored in was not named OwnerOnly it was named OwnerPrecondition. Rename to file OwnerOnly or vice versa - will resolve the issue. Sometimes it's the little things
5 replies
SIASapphire - Imagine a framework
Created by Bejasc on 11/2/2024 in #sapphire-support
Precondition not running
:Facepalm:
5 replies
SIASapphire - Imagine a framework
Created by Bejasc on 7/25/2024 in #sapphire-support
Event before precondition OR access the command via MessageCommandDenied
I know 🙂 We've spoken a few times about this in the past - I'm supporting both and pushing people towards using slash commands. They're definitely easier as a developer, but my community is built from a platform and a time that just does not get along with them.
8 replies
SIASapphire - Imagine a framework
Created by Bejasc on 7/25/2024 in #sapphire-support
Event before precondition OR access the command via MessageCommandDenied
(More snippets, for context)
const DEFAULT_COMMAND_OPTIONS: IDrpgCommandOptions = {
//others
};

export interface IDrpgCommandOptions extends CommandOptions {
//others
deleteAfterPost?: boolean;
}

export abstract class DrpgCommand extends Command {
public readonly fullCategory: readonly string[] = [];

public constructor(context: Command.LoaderContext, options: IDrpgCommandOptions) {
super(context, { ...DEFAULT_COMMAND_OPTIONS, ...options });
}
}
const DEFAULT_COMMAND_OPTIONS: IDrpgCommandOptions = {
//others
};

export interface IDrpgCommandOptions extends CommandOptions {
//others
deleteAfterPost?: boolean;
}

export abstract class DrpgCommand extends Command {
public readonly fullCategory: readonly string[] = [];

public constructor(context: Command.LoaderContext, options: IDrpgCommandOptions) {
super(context, { ...DEFAULT_COMMAND_OPTIONS, ...options });
}
}
@ApplyOptions<IDrpgCommandOptions>({
name: "test",
preconditions: ["PreconditionGoesHere"],
deleteAfterPost: true,
//others
})
export class TestCommand extends Command {
public async messageRun(message: Message, args: Args): Promise<Message> {
//Do things
}
@ApplyOptions<IDrpgCommandOptions>({
name: "test",
preconditions: ["PreconditionGoesHere"],
deleteAfterPost: true,
//others
})
export class TestCommand extends Command {
public async messageRun(message: Message, args: Args): Promise<Message> {
//Do things
}
8 replies
SIASapphire - Imagine a framework
Created by Bejasc on 7/25/2024 in #sapphire-support
Event before precondition OR access the command via MessageCommandDenied
I think I found it actually, PreMessageCommandRun - though still open to feedback about whether this is the best possible place for it
import { Events, Listener, ListenerOptions, PreMessageCommandRunPayload } from "@sapphire/framework";

import { IDrpgCommandOptions } from "../../lib/structures";

export class MessageCommandAccepted extends Listener<typeof Events.PreMessageCommandRun> {
public constructor(context: Listener.LoaderContext, options?: ListenerOptions) {
super(context, { ...options, event: Events.PreMessageCommandRun });
}

public run(payload: PreMessageCommandRunPayload): void {
const drpgOptions = payload.command?.options as IDrpgCommandOptions;
if (drpgOptions?.deleteAfterPost) payload.message.delete();
}
}
import { Events, Listener, ListenerOptions, PreMessageCommandRunPayload } from "@sapphire/framework";

import { IDrpgCommandOptions } from "../../lib/structures";

export class MessageCommandAccepted extends Listener<typeof Events.PreMessageCommandRun> {
public constructor(context: Listener.LoaderContext, options?: ListenerOptions) {
super(context, { ...options, event: Events.PreMessageCommandRun });
}

public run(payload: PreMessageCommandRunPayload): void {
const drpgOptions = payload.command?.options as IDrpgCommandOptions;
if (drpgOptions?.deleteAfterPost) payload.message.delete();
}
}
8 replies
SIASapphire - Imagine a framework
Created by Bejasc on 7/18/2024 in #sapphire-support
Hide Slash/Context menu commands
thanks 😉
7 replies
SIASapphire - Imagine a framework
Created by Bejasc on 7/18/2024 in #sapphire-support
Hide Slash/Context menu commands
It's workable, but I wonder if the re-registration of the command when it's re-deployed will knock it back out.
7 replies
SIASapphire - Imagine a framework
Created by Bejasc on 6/2/2024 in #sapphire-support
Decorator issue
This is my tsconfig, I've been using experimentalDecorators for quite a while, at least 18mo, probably longer (not at pc to check exact)
14 replies
SIASapphire - Imagine a framework
Created by Bejasc on 6/2/2024 in #sapphire-support
Decorator issue
@Boomeravna As mentioned, I already have this enabled
14 replies
SIASapphire - Imagine a framework
Created by Bejasc on 6/2/2024 in #sapphire-support
Decorator issue
Also to add, I've also tried clearing out the dist, node modules, and package lock
14 replies
SIASapphire - Imagine a framework
Created by Bejasc on 6/2/2024 in #sapphire-support
Decorator issue
These errors are only reported when I have the file open that has the decorator error
14 replies