ShowCast
ShowCast
Explore posts from servers
SIASapphire - Imagine a framework
Created by ShowCast on 9/13/2024 in #sapphire-support
Manual Scheduled Task not found
I try to manually schedule a task
const payload = { awesome: true };
await container.tasks.create({ name: 'rememberMe', payload }, 5000);
const payload = { awesome: true };
await container.tasks.create({ name: 'rememberMe', payload }, 5000);
My Task Class in the scheduled-tasks folder
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';

export class RememberTask extends ScheduledTask {
public async run (payload: unknown) {
this.container.logger.info("i ran", payload);
}
}

declare module '@sapphire/plugin-scheduled-tasks' {
interface ScheduledTasks {
rememberMe: never;
}
}
import { ScheduledTask } from '@sapphire/plugin-scheduled-tasks';

export class RememberTask extends ScheduledTask {
public async run (payload: unknown) {
this.container.logger.info("i ran", payload);
}
}

declare module '@sapphire/plugin-scheduled-tasks' {
interface ScheduledTasks {
rememberMe: never;
}
}
I get this error [ScheduledTaskPlugin] There was no task found for "rememberMe" What am I doing wrong?
6 replies
SIASapphire - Imagine a framework
Created by ShowCast on 9/12/2024 in #sapphire-support
Manual Scheduled Task Method Arg Number mismatch with documentation
It's pretty simple: Documentation fo ScheduledTasks plugin says container.tasks.create has 3 arguments as stated in the github readme (https://github.com/sapphiredev/plugins/tree/main/packages/scheduled-tasks): - task – The task to be scheduled. - payload – The payload for the task. - options – The options for the task. But in fact it has only - task - options Where can I pass the payload now?
5 replies
SIASapphire - Imagine a framework
Created by ShowCast on 7/2/2024 in #sapphire-support
Preconditions in InteractionHandler
Can I execute a precondition in an Interaction Handler?
4 replies
DIAdiscord.js - Imagine an app
Created by ShowCast on 6/30/2024 in #djs-questions
Check If Entitlement is still valid
Is there an event fired when an Entitlement with Type Application Subscriptions expires? If not, how can I instantiate an EntitlementManager? Didn't figured out how to do it as it is not documented anywhere. Thanks for helping 🙂
4 replies
DIAdiscord.js - Imagine an app
Created by ShowCast on 5/6/2024 in #djs-questions
Develop with Entitlements
Has anyone an Idea how to delevop with the new Entitlements? I do not want to code on my live Bot with 600+ users. And on my Dev Bot I have no verification and so on I cannot enable the monetization and cannot create SKUs. Any ideas?
4 replies
DIAdiscord.js - Imagine an app
Created by ShowCast on 3/13/2024 in #djs-questions
Follow Up to interaction.deferUpdate() throws error
Hey guys, When I try to followUp() to an ButtonInteraction I get the error InteractionAlreadyReplied. A print of interaction.deferred (true) and interaction.replied (false) shows that it is clearly not already replied. What am I missing here?
11 replies
SIASapphire - Imagine a framework
Created by ShowCast on 9/9/2023 in #sapphire-support
i18n applyLocalizedBuilders Options
I saw in the method parameters one for options. How do I pass them?
applyLocalizedBuilder(
builder,
'lfg', Language.buildCommandTranslationKey(CommandType.lfg, 'command_description'),
{
test: "test"
})
applyLocalizedBuilder(
builder,
'lfg', Language.buildCommandTranslationKey(CommandType.lfg, 'command_description'),
{
test: "test"
})
The example above does not work. How can I do it?
13 replies
SIASapphire - Imagine a framework
Created by ShowCast on 9/7/2023 in #sapphire-support
i18n options are not considered
Hi, While I try to refactor my code I want to implement the i18n plugin the way it is intended. When I call the resolveKey() method i18n wont consider my passed options. Example
await resolveKey(interaction, "help:about_description", {
website: await resolveKey(interaction, "repeating:homepage")
}
await resolveKey(interaction, "help:about_description", {
website: await resolveKey(interaction, "repeating:homepage")
}
The respective content from the json file
"about_description": "[About/Website]({{website}}"
"about_description": "[About/Website]({{website}}"
Every resolveKey() without options works perfectly fine but not with options. Any ideas?
29 replies
SIASapphire - Imagine a framework
Created by ShowCast on 9/7/2023 in #sapphire-support
i18n format issue
Hello guys, I just updated to the newest version of i18n plugin. My format function is now throwing an error I cannot get much context out of: My code
geti18nLanguageString(key: string, customLanguage: Languages | string, guild?: Guild, options?: any): string {
let language = customLanguage;
if (guild !== undefined) {
language = guild.language.toString();
}
if (options) {
return container.i18n.format(language, key, options);
}
return container.i18n.format(language, key);
}
geti18nLanguageString(key: string, customLanguage: Languages | string, guild?: Guild, options?: any): string {
let language = customLanguage;
if (guild !== undefined) {
language = guild.language.toString();
}
if (options) {
return container.i18n.format(language, key, options);
}
return container.i18n.format(language, key);
}
The error occurrs on this line
return container.i18n.format(language, key, options);
return container.i18n.format(language, key, options);
TS2322: Type  string | TFunctionDetailedResult<string>  is not assignable to type  string 
Type  TFunctionDetailedResult<string>  is not assignable to type  string
TS2322: Type  string | TFunctionDetailedResult<string>  is not assignable to type  string 
Type  TFunctionDetailedResult<string>  is not assignable to type  string
The line right under it without options is not throwing an error. Has someone an idea what's the issue is about and how to fix it?
6 replies
SIASapphire - Imagine a framework
Created by ShowCast on 8/31/2023 in #sapphire-support
i18n not part of sapphire container
Hello guys, I just updated my i18n plugin to the latest version (5.1.0) and noticed that since version 5.0.5 i18n seems to not be a piece of the container anymore. I try to access the piece with container.i18n but my IDE tells me that roperty  i18n  does not exist on type  Container Looking into the package made me curious cause in the register.d.ts file the piece is beeing registered and I import the register file in my client. What am I doing wrong?
5 replies
SIASapphire - Imagine a framework
Created by ShowCast on 5/23/2023 in #sapphire-support
Register/delete guild commands on call
As the title already should explain my question but here I go in depth: Is it possible to register/delete guild commands on a specific guild in the runtime?
48 replies
SIASapphire - Imagine a framework
Created by ShowCast on 4/14/2023 in #sapphire-support
Multiple context commands in a single file
Like the topic said I want to register 2 context commands in the same command class. Is that possible, if yes how can I achieve this in my code?
6 replies
SIASapphire - Imagine a framework
Created by ShowCast on 3/28/2023 in #sapphire-support
API Placeholder in Route
I didn't found it in the docs. Is there any way to get a placeholder into a route like in express with /routename/:id so I can use it to get the resource with the respective id?
4 replies
SIASapphire - Imagine a framework
Created by ShowCast on 3/26/2023 in #sapphire-support
API Client with SSL?
Hey guys, currently I am trying to make the switch from an custom express API to the API plugin. Is there a way to let the plugin consume an ssl cert and open a https server? Greetings
5 replies
SIASapphire - Imagine a framework
Created by ShowCast on 2/28/2023 in #sapphire-support
Access extended sapphire client
Following usecase: I extended the sapphire client in order to create custom collections etc. Is there any way I can access the extended client through the container?
14 replies
SIASapphire - Imagine a framework
Created by ShowCast on 1/19/2023 in #sapphire-support
How to create a store
Hey guys, I found nothing in the wiki or documentation on how to register a store neither how to populate it with a piece. I do play with the HMR plugin right now and I noticed with some research that only pieces are getting reloaded on change (as intended). So I searched for a way to add my helper classes to the client container as pieces so they get reloaded aswell. So far I do think that I need to put my helper classes in a store and put them into this store but I didn't found anything related to register a store so maybe you smart guys can help me out by explaining or providing any source of tutorial for me how to do so 🙂 Greetings <:pray_FF:836624926164516875> Can someone explain it?
2 replies
SIASapphire - Imagine a framework
Created by ShowCast on 1/18/2023 in #sapphire-support
Create store for helper classes to access them through the container for hmr to reload it?
Hello there, I do play with the HMR plugin right now and I noticed with some research that only pieces are getting reloaded on change (as intended). So I searched for a way to add my helper classes to the client container as pieces so they get reloaded aswell. So far I do think that I need to put my helper classes in a store and put them into this store but I didn't found anything related to register a store so maybe you smart guys can help me out by explaining or providing any source of tutorial for me how to do so 🙂 Greetings <:pray_FF:836624926164516875>
4 replies
SIASapphire - Imagine a framework
Created by ShowCast on 1/15/2023 in #sapphire-support
Type 'ServerResponse' is not generic
Hello guys, I just updated the sapphire packages and I am encountering an error with the plugin-api. In the ApiResponse (which extends) the ServerResponse it throws an error in the titel "Type 'ServerResponse' is not generic". Has anyone an idea how to fix this? I use the following versions:
"@sapphire/framework": "^4.0.1",
"@sapphire/plugin-api": "^5.0.0"
"@sapphire/framework": "^4.0.1",
"@sapphire/plugin-api": "^5.0.0"
5 replies
DIAdiscord.js - Imagine an app
Created by ShowCast on 9/9/2022 in #djs-questions
Builder Name localization error
Hello guys quick question: I try to localize my options of my slash commands and ran into the error
Error: Invalid string format
Error: Invalid string format
My code causing the error
.setNameLocalizations({
de: 'Beschreibung'
})
.setNameLocalizations({
de: 'Beschreibung'
})
Is it needed for the option name localization to be lowercase or am I doing something wrong I don't see yet?
11 replies