yibuh
yibuh
Explore posts from servers
SIASapphire - Imagine a framework
Created by yibuh on 11/25/2023 in #discordjs-support
Detect when new message is a reply to another one
Hey! Is it possible to detect when a message is a reply? I have a schedules system that automatically replies to you when you tag a member that's not currently available. I'd like the bot to differentiate between explicit mentions (i.e. @member) and message replies, which technically include a mention too. Thanks!
6 replies
SIASapphire - Imagine a framework
Created by yibuh on 11/16/2023 in #sapphire-support
Listeners and Handlers not registering interactions/events
Hey! After the latest release my bot is not responding to any interactions or events. Slash commands, buttons, modals, everything stopped working. I already made the necessary changes to my files
17 replies
SIASapphire - Imagine a framework
Created by yibuh on 11/16/2023 in #sapphire-support
Deployment failing
Hey! My sapphire deployment is failing but I don't really know why. It is giving me some errors on the framework's code apparently:






#11 [stage-0 7/10] COPY . /app/.

#11 DONE 0.1s



#12 [stage-0 8/10] RUN --mount=type=cache,id=s/d9a66794-7b01-4dc8-8c5b-149b515e8a09-node_modules/cache,target=/app/node_modules/.cache npm run build



#12 1.376 npm

WARN config production Use `--omit=dev` instead.

#12 1.497

#12 1.497 > [email protected] build

#12 1.497 > tsc

#12 1.497



#12 17.52 src/interaction-handlers/modals/embed-edit/embed-edit.ts:14:15 - error TS2345: Argument of type 'PieceContext<keyof StoreRegistryEntries>' is not assignable to parameter of type 'LoaderContext'.

#12 17.52 Types of property 'store' are incompatible.

#12 17.52 Type 'ListenerStore | ArgumentStore | CommandStore | InteractionHandlerStore | PreconditionStore' is not assignable to type 'InteractionHandlerStore'.

#12 17.52 Property 'run' is missing in type 'ListenerStore' but required in type 'InteractionHandlerStore'.

#12 17.52

#12 17.52 14 super(ctx, {

#12 17.52 ~~~

#12 17.52



#12 17.52 node_modules/@sapphire/framework/dist/index.d.ts:2372:5

#12 17.52 2372 run(interaction: Interaction): Promise<boolean>;

#12 17.52 ~~~

#12 17.52 'run' is declared here.

#12 17.52

#12 17.52

#12 17.52 Found 1 error in src/interaction-handlers/modals/embed-edit/embed-edit.ts:14

#12 17.52



#12 ERROR: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 2

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/d9a66794-7b01-4dc8-8c5b-149b515e8a09-node_modules/cache,target=/app/node_modules/.cache npm run build:

17.52 ~~~

17.52

17.52 node_modules/@sapphire/framework/dist/index.d.ts:2372:5

17.52 2372 run(interaction: Interaction): Promise<boolean>;

17.52 ~~~

17.52 'run' is declared here.

17.52

17.52

17.52 Found 1 error in src/interaction-handlers/modals/embed-edit/embed-edit.ts:14

17.52

-----



Dockerfile:24

-------------------

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/d9a66794-7b01-4dc8-8c5b-149b515e8a09-node_modules/cache,target=/app/node_modules/.cache npm run build

25 |

26 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 2



Error: Docker build failed






#11 [stage-0 7/10] COPY . /app/.

#11 DONE 0.1s



#12 [stage-0 8/10] RUN --mount=type=cache,id=s/d9a66794-7b01-4dc8-8c5b-149b515e8a09-node_modules/cache,target=/app/node_modules/.cache npm run build



#12 1.376 npm

WARN config production Use `--omit=dev` instead.

#12 1.497

#12 1.497 > [email protected] build

#12 1.497 > tsc

#12 1.497



#12 17.52 src/interaction-handlers/modals/embed-edit/embed-edit.ts:14:15 - error TS2345: Argument of type 'PieceContext<keyof StoreRegistryEntries>' is not assignable to parameter of type 'LoaderContext'.

#12 17.52 Types of property 'store' are incompatible.

#12 17.52 Type 'ListenerStore | ArgumentStore | CommandStore | InteractionHandlerStore | PreconditionStore' is not assignable to type 'InteractionHandlerStore'.

#12 17.52 Property 'run' is missing in type 'ListenerStore' but required in type 'InteractionHandlerStore'.

#12 17.52

#12 17.52 14 super(ctx, {

#12 17.52 ~~~

#12 17.52



#12 17.52 node_modules/@sapphire/framework/dist/index.d.ts:2372:5

#12 17.52 2372 run(interaction: Interaction): Promise<boolean>;

#12 17.52 ~~~

#12 17.52 'run' is declared here.

#12 17.52

#12 17.52

#12 17.52 Found 1 error in src/interaction-handlers/modals/embed-edit/embed-edit.ts:14

#12 17.52



#12 ERROR: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 2

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/d9a66794-7b01-4dc8-8c5b-149b515e8a09-node_modules/cache,target=/app/node_modules/.cache npm run build:

17.52 ~~~

17.52

17.52 node_modules/@sapphire/framework/dist/index.d.ts:2372:5

17.52 2372 run(interaction: Interaction): Promise<boolean>;

17.52 ~~~

17.52 'run' is declared here.

17.52

17.52

17.52 Found 1 error in src/interaction-handlers/modals/embed-edit/embed-edit.ts:14

17.52

-----



Dockerfile:24

-------------------

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/d9a66794-7b01-4dc8-8c5b-149b515e8a09-node_modules/cache,target=/app/node_modules/.cache npm run build

25 |

26 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 2



Error: Docker build failed
Any help is appreciated 🙂 Thanks in advance
8 replies
SIASapphire - Imagine a framework
Created by yibuh on 11/6/2023 in #sapphire-support
Handle secondary bots from main
Hey! I am working on a meetings system that would require my bot to join meetings and record transcriptions. As we have several meetings and sometimes they overlap, I'd like to handle two to three secondary bots that would join the meeting when others are occupied. Is it possible to handle this logic in sapphire? How could that be done? Thank you!
8 replies
SIASapphire - Imagine a framework
Created by yibuh on 10/29/2023 in #sapphire-support
The inferred type of 'parse' cannot be named without a reference to...
Hey! I am getting this error while trying to create an interaction handler: The inferred type of 'parse' cannot be named without a reference to '.pnpm/@[email protected]/node_modules/@sapphire/result'. This is likely not portable. A type annotation is necessary. This is my code:
import { InteractionHandler, InteractionHandlerTypes, PieceContext } from "@sapphire/framework";
import { ModalSubmitInteraction } from "discord.js";
import { ApplyOptions } from "@sapphire/decorators";

export class EmbedEditModal extends InteractionHandler {
public constructor(ctx: PieceContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.ModalSubmit
})
}

public override parse(interaction: ModalSubmitInteraction) {
return interaction.customId.startsWith('embed-edit') ? this.some() : this.none()
}
}
import { InteractionHandler, InteractionHandlerTypes, PieceContext } from "@sapphire/framework";
import { ModalSubmitInteraction } from "discord.js";
import { ApplyOptions } from "@sapphire/decorators";

export class EmbedEditModal extends InteractionHandler {
public constructor(ctx: PieceContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.ModalSubmit
})
}

public override parse(interaction: ModalSubmitInteraction) {
return interaction.customId.startsWith('embed-edit') ? this.some() : this.none()
}
}
8 replies
SIASapphire - Imagine a framework
Created by yibuh on 9/28/2023 in #sapphire-support
AutoComplete subcommand name/id
Hello! I'm trying to use autocomplete interactions for my subcommands. Both subcommands (start & end) have the same autocomplete option called 'event'. I'd like to be able to identify which subcommand is being used to use a different logic for each one. Is this possible? Currently I am only able to access the command's information but not the subcommands.
5 replies
SIASapphire - Imagine a framework
Created by yibuh on 6/24/2023 in #sapphire-support
__importStar is not defined
Hey! I am using a star import in my bot but whenever I try to run the dev script, it gives me the following error:
const dotenv = __importStar(require("dotenv"));
ReferenceError: __importStar is not defined
const dotenv = __importStar(require("dotenv"));
ReferenceError: __importStar is not defined
I guess it is more a TypeScript related issue. This is the line that's causing it:
import * as dotenv from 'dotenv';
import * as dotenv from 'dotenv';
3 replies
SIASapphire - Imagine a framework
Created by yibuh on 6/15/2023 in #sapphire-support
Creating a button handler
Hey! I would like to know if there is a way to create a button handler using Sapphire. I would like to read all files from a folder called "buttons" and store the data inside my container. I'd then check if there is an existing button with the given interaction id inside my container and if there is, I'd run the execute function. I came up with some code but can't manage to get it working. I'll attach it down below. Thanks in advance for all the help 🙂
8 replies
SIASapphire - Imagine a framework
Created by yibuh on 6/13/2023 in #sapphire-support
New to Sapphire! Where should I start?
Hey! I've been developing Discord bots with discord.js for over two years now and I've recently made the jump to Sapphire and TypeScript. Where should I start? I am reading the guide to get an idea of how the framework works but I'd really appreciate any tips or guidance on what my next steps should be. Thank you very much in advance 🫶
4 replies