jack.ink
jack.ink
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
for now I'm just running preconditions as if statements
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
alright, no issue
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
just checking if you've found anything
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "Node",
"strict": true,
"skipLibCheck": true,
"outDir": "out",
"rootDir": "src",
},
"exclude": [
"drizzle.config.ts"
]
}
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "Node",
"strict": true,
"skipLibCheck": true,
"outDir": "out",
"rootDir": "src",
},
"exclude": [
"drizzle.config.ts"
]
}
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
@Favna could any of my tsconfig settings be important?
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
I'll get that sent to you, I completely understand the delays
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
{
"type": "module",
"main": "out/index.js",
"dependencies": {
"@sapphire/discord.js-utilities": "^7.0.1",
"@sapphire/framework": "^4.5.1",
"@sapphire/plugin-subcommands": "^4.0.2",
"discord.js": "^14.12.1",
"drizzle-orm": "^0.27.2",
"express": "^4.18.2",
"mysql2": "^3.6.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"drizzle-kit": "^0.19.12",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
},
"scripts": {
"start": "tsc && node out/index"
}
}
{
"type": "module",
"main": "out/index.js",
"dependencies": {
"@sapphire/discord.js-utilities": "^7.0.1",
"@sapphire/framework": "^4.5.1",
"@sapphire/plugin-subcommands": "^4.0.2",
"discord.js": "^14.12.1",
"drizzle-orm": "^0.27.2",
"express": "^4.18.2",
"mysql2": "^3.6.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"drizzle-kit": "^0.19.12",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.9.0",
"prettier": "^3.0.0",
"typescript": "^5.1.6"
},
"scripts": {
"start": "tsc && node out/index"
}
}
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
alright
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
its very weird, if you need a zip for some obscure detail I can provide
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
when I place a debug console.log anywhere in the precondition or the command, they just don't output when there is a precondition
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
but one important thing to note is that when I tested it without any preconditions it worked as expected
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
its a very large command, so I didn't put in the actual code
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
export class Config extends Subcommand {
public constructor(context: Subcommand.Context, options: Subcommand.Options) {
super(context, {
...options,
name: "config",
description: "Config all the settings for the group.",
preconditions: ["Setup"],
subcommands: [
{
name: "verified",
chatInputRun: "setVerifiedRole",
},
{
name: "ranks",
type: "group",

entries: [
{
name: "load",
chatInputRun: "loadRanks",
},
],
},
],
});
}

public registerApplicationCommands(registry: Subcommand.Registry) {
registry.registerChatInputCommand(
builder => {
builder
.setName(this.name)
.setDescription(this.description)
.addSubcommand(command =>
command
.setName("verified")
.setDescription("Change the verified role")
.addRoleOption(option =>
option
.setName("role")
.setDescription(
"The role to give verified users, or none to not give them a role",
)
.setRequired(false),
),
)
.addSubcommandGroup(group =>
group
.setName("ranks")
.setDescription("Change configuration related to ranks")
.addSubcommand(command =>
command
.setName("load")
.setDescription("Load all ranks from the roblox group"),
),
);
},
{
idHints: ["1137656879930146836"],
},
);
}

...
}
export class Config extends Subcommand {
public constructor(context: Subcommand.Context, options: Subcommand.Options) {
super(context, {
...options,
name: "config",
description: "Config all the settings for the group.",
preconditions: ["Setup"],
subcommands: [
{
name: "verified",
chatInputRun: "setVerifiedRole",
},
{
name: "ranks",
type: "group",

entries: [
{
name: "load",
chatInputRun: "loadRanks",
},
],
},
],
});
}

public registerApplicationCommands(registry: Subcommand.Registry) {
registry.registerChatInputCommand(
builder => {
builder
.setName(this.name)
.setDescription(this.description)
.addSubcommand(command =>
command
.setName("verified")
.setDescription("Change the verified role")
.addRoleOption(option =>
option
.setName("role")
.setDescription(
"The role to give verified users, or none to not give them a role",
)
.setRequired(false),
),
)
.addSubcommandGroup(group =>
group
.setName("ranks")
.setDescription("Change configuration related to ranks")
.addSubcommand(command =>
command
.setName("load")
.setDescription("Load all ranks from the roblox group"),
),
);
},
{
idHints: ["1137656879930146836"],
},
);
}

...
}
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
and my startup file is properly defined
28 replies
SIASapphire - Imagine a framework
Created by jack.ink on 8/6/2023 in #sapphire-support
preconditions don't run
import { Precondition } from "@sapphire/framework";
import type {
ChatInputCommandInteraction,
ContextMenuCommandInteraction,
} from "discord.js";

export class UserPrecondition extends Precondition {
public override chatInputRun(interaction: ChatInputCommandInteraction) {
return this.ok();
}

public override contextMenuRun(interaction: ContextMenuCommandInteraction) {
return this.ok();
}
}

declare module "@sapphire/framework" {
interface Preconditions {
Setup: never;
}
}
import { Precondition } from "@sapphire/framework";
import type {
ChatInputCommandInteraction,
ContextMenuCommandInteraction,
} from "discord.js";

export class UserPrecondition extends Precondition {
public override chatInputRun(interaction: ChatInputCommandInteraction) {
return this.ok();
}

public override contextMenuRun(interaction: ContextMenuCommandInteraction) {
return this.ok();
}
}

declare module "@sapphire/framework" {
interface Preconditions {
Setup: never;
}
}
28 replies