mallusrgreat
mallusrgreat
Explore posts from servers
SIASapphire - Imagine a framework
Created by mallusrgreat on 8/9/2024 in #sapphire-support
Interaction handler parse never being called
import { ApplyOptions } from "@sapphire/decorators";
import {
InteractionHandler,
InteractionHandlerTypes,
} from "@sapphire/framework";
import type { AutocompleteInteraction } from "discord.js";
import config from "../config.js";
...
// logs correctly
console.log('fuse')
@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.Autocomplete,
})
export class AutocompleteHandler extends InteractionHandler {
...
public override async parse(interaction: AutocompleteInteraction) {
const focusedOption = interaction.options.getFocused(true);
// doesnt log
console.log(focusedOption.name);
switch (focusedOption.name) {
case "server_name": {
// doesnt log
console.log("test");
return this.some(
..
);
}
default:
return this.none();
}
}
}
import { ApplyOptions } from "@sapphire/decorators";
import {
InteractionHandler,
InteractionHandlerTypes,
} from "@sapphire/framework";
import type { AutocompleteInteraction } from "discord.js";
import config from "../config.js";
...
// logs correctly
console.log('fuse')
@ApplyOptions<InteractionHandler.Options>({
interactionHandlerType: InteractionHandlerTypes.Autocomplete,
})
export class AutocompleteHandler extends InteractionHandler {
...
public override async parse(interaction: AutocompleteInteraction) {
const focusedOption = interaction.options.getFocused(true);
// doesnt log
console.log(focusedOption.name);
switch (focusedOption.name) {
case "server_name": {
// doesnt log
console.log("test");
return this.some(
..
);
}
default:
return this.none();
}
}
}
5 replies
SIASapphire - Imagine a framework
Created by mallusrgreat on 8/2/2024 in #sapphire-support
Sentry with Sapphire?
Sapphire handles all errors for me so they don't go into Sentry, what should I do?
4 replies
SIASapphire - Imagine a framework
Created by mallusrgreat on 6/3/2024 in #sapphire-support
args provided but not found?
No description
10 replies
SIASapphire - Imagine a framework
Created by mallusrgreat on 4/22/2024 in #sapphire-support
Subcommand Aliases
How can I add aliases to subcommands? Is it not possible?
6 replies
SIASapphire - Imagine a framework
Created by mallusrgreat on 4/6/2024 in #sapphire-support
Sapphire with TypeScript & Bun
How does sapphire import files? Does it work fine with bun with typescript?
5 replies
DIAdiscord.js - Imagine a bot
Created by mallusrgreat on 3/9/2024 in #djs-questions
Channel not being created
Bot is not rate limited.
await Promise.all(
data.channels
.filter(
(channel) => "isThread" in channel && !channel?.isThread()
)
.map(async (channel) => {
if (channel.isThread()) return;
return await guild.channels
.create({
name: channel.name,
type: channel.type,
parent: channelsMap.get(channel.parentId!),
permissionOverwrites: Array.from(
channel.permissionOverwrites.cache.values()
).map((v) =>
v.type === OverwriteType.Role
? { ...v, id: rolesMap.get(v.id)! }
: v
),
......
})
.catch(console.error)
.then((ch) => {
console.log("w");
if (!ch) return;
console.log(ch.name);
channelsMap.set(channel.id, ch.id);
});
})
);
progress[6] = "Created all channels";
await Promise.all(
data.channels
.filter(
(channel) => "isThread" in channel && !channel?.isThread()
)
.map(async (channel) => {
if (channel.isThread()) return;
return await guild.channels
.create({
name: channel.name,
type: channel.type,
parent: channelsMap.get(channel.parentId!),
permissionOverwrites: Array.from(
channel.permissionOverwrites.cache.values()
).map((v) =>
v.type === OverwriteType.Role
? { ...v, id: rolesMap.get(v.id)! }
: v
),
......
})
.catch(console.error)
.then((ch) => {
console.log("w");
if (!ch) return;
console.log(ch.name);
channelsMap.set(channel.id, ch.id);
});
})
);
progress[6] = "Created all channels";
The progress[6] gets changed, but nothing is logged. I can also confirm that there are channels in data.channels
4 replies
DIAdiscord.js - Imagine a bot
Created by mallusrgreat on 3/8/2024 in #djs-questions
Creating emojis promise doesn't resolve
progress.push("Creating emojis...");
msg?.edit(progress.join("\n"));
try {
await Promise.all(
data.emojis.map(async (emoji, i) => {
return await guild.emojis
.create({
name: emoji.name!,
attachment: emoji.url,
roles: emoji.roles
? Array.from(emoji.roles.cache.values())
: undefined,
reason: "Backup",
})
.then((r) => {
console.log(r);
if (!r) return;
rolesMap.set(emoji.id, r.id);
progress[4] = `Created emojis ${i + 1}/${
data.emojis.length
}.`;
msg?.edit(progress.join("\n"));
})
.catch(console.error);
})
);
progress[4] = "Created all emojis.";
progress.push("Creating roles...");
msg?.edit(progress.join("\n"));
.....
progress.push("Creating emojis...");
msg?.edit(progress.join("\n"));
try {
await Promise.all(
data.emojis.map(async (emoji, i) => {
return await guild.emojis
.create({
name: emoji.name!,
attachment: emoji.url,
roles: emoji.roles
? Array.from(emoji.roles.cache.values())
: undefined,
reason: "Backup",
})
.then((r) => {
console.log(r);
if (!r) return;
rolesMap.set(emoji.id, r.id);
progress[4] = `Created emojis ${i + 1}/${
data.emojis.length
}.`;
msg?.edit(progress.join("\n"));
})
.catch(console.error);
})
);
progress[4] = "Created all emojis.";
progress.push("Creating roles...");
msg?.edit(progress.join("\n"));
.....
For some reason, its stuck at Creating emojis... and r doesn't get logged
6 replies