Juan Pablo
Juan Pablo
SIASapphire - Imagine a framework
Created by Juan Pablo on 10/6/2024 in #sapphire-support
registerContextMenuCommand type error
No description
4 replies
SIASapphire - Imagine a framework
Created by Juan Pablo on 1/31/2024 in #discordjs-support
Make a button executable only by the command executer
Hello, I want to make a button only executable only by the person who ran it. For example, if person A runs command fuzz only they are allowed to click on button B I thought this would work it seems to split out [ERROR] Encountered error while handling an interaction handler run method for interaction-handler "bankButton" at path "C:\Users\Isidr\Documents\GitHub\cobaltia\cobaltia\dist\interaction-handlers\buttons\bankButton.js" TypeError: Cannot read properties of undefined (reading 'id')
const user = interaction.message.mentions.users.first()!;
if (interaction.user.id !== user.id) return;
const user = interaction.message.mentions.users.first()!;
if (interaction.user.id !== user.id) return;
Also, update the tags to include 14.14.x
17 replies
SIASapphire - Imagine a framework
Created by Juan Pablo on 3/3/2023 in #discordjs-support
Docker being goofy
I have no idea why Docker is being all goofy, it's saying that my discord token is invalid, but it's not the case. I did reset the token just in case, and the error still persists. I'm wondering if anyone else has come across a similar problem and how they fixed it https://juan.evaded.tax/i/fb088.png
8 replies
SIASapphire - Imagine a framework
Created by Juan Pablo on 2/4/2023 in #discordjs-support
SyntaxError: The requested module '@discordjs/util' does not provide an export named 'calculateShard
I am unsure where to go for help, so I'm putting it here. I have no idea where this error is coming from. I looked into ws and rest, and I can't find anything that points me to right direction
import { Client, GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags } from '@discordjs/core';
import { REST } from '@discordjs/rest';
import { WebSocketManager } from '@discordjs/ws';
import { DurationFormatter } from '@sapphire/duration';
import { RateLimitManager } from '@sapphire/ratelimits';
import { Time } from '@sapphire/timestamp';
import { token } from './config.js';

const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

const client = new Client({ rest, ws });

const formatter = new DurationFormatter();
const rateLimitManager = new RateLimitManager(Time.Day, 50);
const ratelimit = rateLimitManager.acquire('global');

client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
console.log(interaction);
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ask') return;
if (ratelimit.limited) {
await api.interactions.reply(interaction.id, interaction.token, {
content: `The command is on a cooldown.\nYou'll be able to use the commands again in ${formatter.format(
ratelimit.remainingTime,
)}`,
});
return;
}

await api.interactions.reply(interaction.id, interaction.token, { content: 'Pong!', flags: MessageFlags.Ephemeral });
ratelimit.consume();
});
import { Client, GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags } from '@discordjs/core';
import { REST } from '@discordjs/rest';
import { WebSocketManager } from '@discordjs/ws';
import { DurationFormatter } from '@sapphire/duration';
import { RateLimitManager } from '@sapphire/ratelimits';
import { Time } from '@sapphire/timestamp';
import { token } from './config.js';

const rest = new REST({ version: '10' }).setToken(token);
const ws = new WebSocketManager({
token,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

const client = new Client({ rest, ws });

const formatter = new DurationFormatter();
const rateLimitManager = new RateLimitManager(Time.Day, 50);
const ratelimit = rateLimitManager.acquire('global');

client.on(GatewayDispatchEvents.InteractionCreate, async ({ data: interaction, api }) => {
console.log(interaction);
if (interaction.type !== InteractionType.ApplicationCommand || interaction.data.name !== 'ask') return;
if (ratelimit.limited) {
await api.interactions.reply(interaction.id, interaction.token, {
content: `The command is on a cooldown.\nYou'll be able to use the commands again in ${formatter.format(
ratelimit.remainingTime,
)}`,
});
return;
}

await api.interactions.reply(interaction.id, interaction.token, { content: 'Pong!', flags: MessageFlags.Ephemeral });
ratelimit.consume();
});
https://juan.evaded.tax/i/9qdgu.png
11 replies
SIASapphire - Imagine a framework
Created by Juan Pablo on 1/28/2023 in #sapphire-support
@skyra/env-utilities is not assignable to parameter of type 'never'
I am not sure what to do here https://juan.evaded.tax/i/k6e74.png
35 replies