net-tech-
net-tech-
Explore posts from servers
BSBuape Studios
Created by net-tech- on 8/22/2024 in #kiai-support
Multiplier not being applied correctly
32 replies
PPrisma
Created by net-tech- on 4/27/2024 in #help-and-questions
Prisma warns of data loss when changing required field to optional, even when there is a default val
Hi there, I currently a column with this row:
autoDeleteIntroductionsOnLeave Boolean? @default(false)
autoDeleteIntroductionsOnLeave Boolean? @default(false)
and I am trying to change it to
autoDeleteIntroductionsOnLeave Boolean @default(false)
autoDeleteIntroductionsOnLeave Boolean @default(false)
however, even with the default value I get an error while trying to use db push:
@internal/database:db:push: ⚠️ We found changes that cannot be executed:
@internal/database:db:push:
@internal/database:db:push: • Made the column `autoDeleteIntroductionsOnLeave` on table `Guild` required, but there are 5 existing NULL values.
@internal/database:db:push:
@internal/database:db:push:
✔ To apply this change we need to reset the database, do you want to continue? All data will be lost. … no
@internal/database:db:push: ⚠️ We found changes that cannot be executed:
@internal/database:db:push:
@internal/database:db:push: • Made the column `autoDeleteIntroductionsOnLeave` on table `Guild` required, but there are 5 existing NULL values.
@internal/database:db:push:
@internal/database:db:push:
✔ To apply this change we need to reset the database, do you want to continue? All data will be lost. … no
is there a way for me to just tell prisma to use false, as I defined using @default, since it seems quite logical to me. --- System Information: macOS Version: 14.4.1 Chip: Apple M2 Pro Architecture: arm64 JavaScript/TypeScript Project Information: Node.js Version: v20.4.0 TypeScript Version: Version 5.4.3 @prisma/client Version: 5.11.0 prisma Version: 5.11.0
9 replies
SIASapphire - Imagine a framework
Created by net-tech- on 3/12/2024 in #sapphire-support
Using JSON to register application commands and add options
Hi there, Is there a way to add all of my application command options in the registerApplicationCommands method on the Command class without using builders? For example, a registerApplicationCommands method might look like this currently, to register options:
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
.addSubcommand((subcommand) =>
subcommand
.setName("register")
.setDescription(
"Registers your friend code so you can share it with others."
)
.addStringOption((option) =>
option
.setName("code")
.setDescription("Your friend code.")
.setRequired(true)
)
)
public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder //
.setName(this.name)
.setDescription(this.description)
.addSubcommand((subcommand) =>
subcommand
.setName("register")
.setDescription(
"Registers your friend code so you can share it with others."
)
.addStringOption((option) =>
option
.setName("code")
.setDescription("Your friend code.")
.setRequired(true)
)
)
--- My use case is that I have a constant array of settings I'd like the user to be able to configure, and it would be nice if I could do something like automatically add a non-required slash command option for each setting. Then the command could look something like /settings set setting1 setting2 setting3 ...
6 replies
LSLurkr Support
Created by net-tech- on 12/29/2023 in #support
Leveling Formula
Hi there, what formula does Lurkr use to calculate XP from level or vice versa?
4 replies
SIASapphire - Imagine a framework
Created by net-tech- on 12/23/2023 in #sapphire-support
Removing pagination buttons on last page
Hi there, what is the recommended way to remove the pagination buttons on the last page when using the paginator in sapphire djs utilities?
4 replies
DTDrizzle Team
Created by net-tech- on 10/7/2023 in #help
Alerting if there is conflict
I'm doing an insert and wanted to ask whether there is a specific error type that is returned when there is a conflict. Pseudo-code of what I would want
await db.insert(guild).values({ id: interaction.guildId })
.catch((error) => {
if (error.type === "conflict") {
alert("This already exists")
}
})
await db.insert(guild).values({ id: interaction.guildId })
.catch((error) => {
if (error.type === "conflict") {
alert("This already exists")
}
})
3 replies
SIASapphire - Imagine a framework
Created by net-tech- on 8/6/2023 in #sapphire-support
Unknown interaction with paginated message custom actions
Hi there, I'm using sapphire's paginated messages from @sapphire/discord.js-utilities. Before adding custom actions, a stop button worked fine. I recently set custom actions to:
leaderboard.setActions([
{
emoji: Emoji.LeftChevron,
customId: "x-previous",
type: ComponentType.Button,
style: ButtonStyle.Secondary,
run: ({ handler }) => {
if (handler.index === 0) {
handler.index = handler.pages.length - 1;
} else {
--handler.index;
}
},
},
{
emoji: Emoji.RightChevron,
customId: "x-next",
type: ComponentType.Button,
style: ButtonStyle.Secondary,
run: ({ handler }) => {
if (handler.index === handler.pages.length - 1) {
handler.index = 0;
} else {
++handler.index;
}
},
},
{
emoji: Emoji.Cross,
customId: "x-stop",
type: ComponentType.Button,
style: ButtonStyle.Secondary,
run: ({ collector }) => {
collector.stop("stopped");
},
},
]);
leaderboard.setActions([
{
emoji: Emoji.LeftChevron,
customId: "x-previous",
type: ComponentType.Button,
style: ButtonStyle.Secondary,
run: ({ handler }) => {
if (handler.index === 0) {
handler.index = handler.pages.length - 1;
} else {
--handler.index;
}
},
},
{
emoji: Emoji.RightChevron,
customId: "x-next",
type: ComponentType.Button,
style: ButtonStyle.Secondary,
run: ({ handler }) => {
if (handler.index === handler.pages.length - 1) {
handler.index = 0;
} else {
++handler.index;
}
},
},
{
emoji: Emoji.Cross,
customId: "x-stop",
type: ComponentType.Button,
style: ButtonStyle.Secondary,
run: ({ collector }) => {
collector.stop("stopped");
},
},
]);
Now, when I click the stop button. I get a djs error in the console:
DiscordAPIError[10062]: Unknown interaction
// other stack trace paths here

at async safelyReplyToInteraction (file:///Users/net-tech-/Developer/anime-interlink-typescript/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/discord.js-utilities/dist/index.mjs:664:7)
DiscordAPIError[10062]: Unknown interaction
// other stack trace paths here

at async safelyReplyToInteraction (file:///Users/net-tech-/Developer/anime-interlink-typescript/node_modules/.pnpm/@[email protected]/node_modules/@sapphire/discord.js-utilities/dist/index.mjs:664:7)
Am I not stopping the paginator correctly?
7 replies
DIAdiscord.js - Imagine an app
Created by net-tech- on 7/28/2023 in #djs-questions
Migrating to v14 (Typescript)
Hi there I'm having trouble porting this v13 code over to v14
1 const msg = interaction.targetMessage as Message;
2
3 const components = msg?.components;
4
5 let row = components.find(
6 (x) => x.components.length < 5
7 );
8
9 if (!row) {
10 components.push(new MessageActionRow());
11 row = components[components.length - 1];
12 }
13
14 row.addComponents(button);
1 const msg = interaction.targetMessage as Message;
2
3 const components = msg?.components;
4
5 let row = components.find(
6 (x) => x.components.length < 5
7 );
8
9 if (!row) {
10 components.push(new MessageActionRow());
11 row = components[components.length - 1];
12 }
13
14 row.addComponents(button);
More specifically, in v14, ActionRow is private and components won't accept ActionRowBuilder because
Type 'ActionRowBuilder<AnyComponentBuilder>' is missing the following properties from type 'ActionRow<MessageActionRowComponent>': type, equals
Type 'ActionRowBuilder<AnyComponentBuilder>' is missing the following properties from type 'ActionRow<MessageActionRowComponent>': type, equals
.
5 replies
SIASapphire - Imagine a framework
Created by net-tech- on 7/16/2023 in #sapphire-support
Trouble with telling typescript the return type of fetch when using @sapphire/result
Hi there, I have a function that fetches an API using the native fetch function. The fetch is wrapped in Result.fromAsync(), and I wanted to do Result.fromAsync<Promise<APIResponse>> since I know what the API will return. The problem is, when doing Result.fromAsync<Promise<APIResponse>> Typescript says that Response is missing certain properties that I know the API will return. How would I tell Typescript I know that the fetch will return this?
Result.fromAsync<Promise<OMGLOLAPIResponse>>(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Argument of type 'Promise<Response>' is not assignable to parameter of type 'Awaitable<Resolvable<Promise<OMGLOLAPIResponse>, unknown>> | (() => Awaitable<Resolvable<Promise<OMGLOLAPIResponse>, unknown>>)'.
Type 'Promise<Response>' is not assignable to type 'Promise<OMGLOLAPIResponse>'.
Type 'Response' is missing the following properties from type 'OMGLOLAPIResponse': request, response ts(2345)

fetch(`${OMGLOL_API_URL}/address/${ADDRESS}/purl`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OMGLOL_API_KEY}`
},
body: JSON.stringify({
name: path,
url: destination,
listed: true
})
})
)
Result.fromAsync<Promise<OMGLOLAPIResponse>>(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Argument of type 'Promise<Response>' is not assignable to parameter of type 'Awaitable<Resolvable<Promise<OMGLOLAPIResponse>, unknown>> | (() => Awaitable<Resolvable<Promise<OMGLOLAPIResponse>, unknown>>)'.
Type 'Promise<Response>' is not assignable to type 'Promise<OMGLOLAPIResponse>'.
Type 'Response' is missing the following properties from type 'OMGLOLAPIResponse': request, response ts(2345)

fetch(`${OMGLOL_API_URL}/address/${ADDRESS}/purl`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OMGLOL_API_KEY}`
},
body: JSON.stringify({
name: path,
url: destination,
listed: true
})
})
)
15 replies
SIASapphire - Imagine a framework
Created by net-tech- on 7/13/2023 in #sapphire-support
'Can't find the template.' on a template listed in the docs
When running sapphire generate buttoninteractionhandler customRole I get the error Can't find the template., however, https://www.sapphirejs.dev/docs/Guide/CLI/generating-components lists buttoninteractionhandler as a component.
4 replies
SIASapphire - Imagine a framework
Created by net-tech- on 4/20/2023 in #sapphire-support
What does sapphire's logger use on the backend?
Winston, pino, something else?
10 replies
SIASapphire - Imagine a framework
Created by net-tech- on 4/2/2023 in #sapphire-support
Proper pnpm support
I keep getting
The inferred type of 'parse' cannot be named without a reference to '../../node_modules/.pnpm/@[email protected]/node_modules/@sapphire/result/dist/lib/Option/Some.js'. This is likely not portable. A type annotation is necessary.
The inferred type of 'parse' cannot be named without a reference to '../../node_modules/.pnpm/@[email protected]/node_modules/@sapphire/result/dist/lib/Option/Some.js'. This is likely not portable. A type annotation is necessary.
in any situation where I use
public override parse(
public override parse(
which the docs use in multiple examples. A quick search reveals that the suggested solution is adding
public-hoist-pattern[]=*@sapphire*
public-hoist-pattern[]=*@sapphire*
however this does not resolve the issue. If the issue is indeed from pnpm's side, couldn't a maintainer of sapphire open an issue in pnpm's git repo about this since it's a pretty big thing? It seems a bit ignorant to tell the user to "switch to yarn" if they use pnpm. pnpm is a pretty popular choice, with over 3 million weekly downloads. Normally I would open an issue on pnpm's repo. However, I don't really have deep enough technical knowledge as to what exactly is happening to open a good bug report.
6 replies
SIASapphire - Imagine a framework
Created by net-tech- on 3/14/2023 in #sapphire-support
Monorepos
Does Sapphire work and play nice with monorepos?
6 replies
SIASapphire - Imagine a framework
Created by net-tech- on 3/6/2023 in #sapphire-support
Interaction Handlers
Am I required to specify to sapphire where my interaction handlers directory is? A interaction-handlers directory doesn't seem to be detected. - ├─ Loaded 0 interaction-handlers.
29 replies
CDCloudflare Developers
Created by net-tech- on 2/13/2023 in #workers-help
No loader is configured for ".png"
✘ [ERROR] No loader is configured for ".png" files: static/pr.png

index.js:1:15:
1import pr from "./static/pr.png"
~~~~~~~~~~~~~~~~~


✘ [ERROR] Build failed with 1 error:

index.js:1:15: ERROR: No loader is configured for ".png" files: static/pr.png
✘ [ERROR] No loader is configured for ".png" files: static/pr.png

index.js:1:15:
1import pr from "./static/pr.png"
~~~~~~~~~~~~~~~~~


✘ [ERROR] Build failed with 1 error:

index.js:1:15: ERROR: No loader is configured for ".png" files: static/pr.png
How and where do I specify a loader for .png files?
4 replies
SIASapphire - Imagine a framework
Created by net-tech- on 1/9/2023 in #sapphire-support
ChatInputCommandError Event not firing
I'm having trouble with this code https://hst.sh/odutopaniv.typescript in that the event is not firing when a command errors and this is being logged by sapphire natively https://hst.sh/ivezicirex.apache
6 replies
SIASapphire - Imagine a framework
Created by net-tech- on 1/9/2023 in #sapphire-support
What does commandError emit?
I'm struggling to find what commandError emits when fired by sapphire.
12 replies
SIASapphire - Imagine a framework
Created by net-tech- on 1/9/2023 in #sapphire-support
Am I doing this wrong? I feel like I'm doing this wrong.
Hey there, In my ping command I'm doing void interaction.reply(await resolveKey(interaction, "ping:success", { ping })) because I'm using eslint and it is screaming
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator.
when not using void. Is this a good way of handling the eslint error or is there a better one. resolveKey is from @sapphire/plugin-i18next and the eslint config is from @sapphire/eslint-config.
5 replies
SIASapphire - Imagine a framework
Created by net-tech- on 1/8/2023 in #sapphire-support
Namespace 'Command' has no exported member 'ChatInputInteraction'.
Hey there, I'm following the guide at https://www.sapphirejs.dev/docs/Guide/getting-started/creating-a-basic-app-command, and I'm getting the error Namespace 'Command' has no exported member 'ChatInputInteraction'. on this line.
public async chatInputRun(interaction: Command.ChatInputInteraction)
public async chatInputRun(interaction: Command.ChatInputInteraction)
Intellisense offers me autocomplete for Command.ChatInputCommandInteraction. Is this a mistake in the guide?
8 replies