Freakspot
Freakspot
SIASapphire - Imagine a framework
Created by Freakspot on 1/12/2023 in #sapphire-support
Failed to overwrite global application commands
Ohh, I understand how it should be. That's such an obvious mistake to me now. Thank you very much!
12 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/12/2023 in #sapphire-support
Failed to overwrite global application commands
This is the content of a file located in src/commands/General; without this file present, the error does not pop up
12 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/12/2023 in #sapphire-support
Failed to overwrite global application commands
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import { ChannelType } from 'discord.js';
const { fetch } = require('undici');

@ApplyOptions<Command.Options>({
description: 'Does some things.'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
// Register slash command
registry.registerChatInputCommand({
name: this.name,
description: this.description
});

registry.registerChatInputCommand((builder) =>
builder.setName(this.name).setDescription(this.description).addStringOption((option) => option.setName('game').setDescription('Provide a game to add to gaming-list').setRequired(true)));
}

// slash command
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const nameOfGameOld = interaction.options.getString('game');
await interaction.reply({
content: `Looking for game "${nameOfGameOld}"`
});

// TODO: find ID programmatically rather than set it here
const channel = await interaction.guild?.channels.cache.get(ValidIdIsHere);

// Should never happen as long as ID is provided manually
if (channel?.type !== ChannelType.GuildForum) {
return;
}

const response = await fetch(`https://api.steampowered.com/ISteamApps/GetAppList/v2?format=json`);
const { applist } = await response.json();
const results = applist.apps.filter((app: any) => app.name === nameOfGameOld);

if (!results || results.length === 0) {
return await interaction.editReply({
content: 'Could not find any games matching your query!'
});
}
return await interaction.editReply({ content: `Created an entry for "${nameOfGameOld}"` });
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { Command } from '@sapphire/framework';
import { ChannelType } from 'discord.js';
const { fetch } = require('undici');

@ApplyOptions<Command.Options>({
description: 'Does some things.'
})
export class UserCommand extends Command {
public override registerApplicationCommands(registry: Command.Registry) {
// Register slash command
registry.registerChatInputCommand({
name: this.name,
description: this.description
});

registry.registerChatInputCommand((builder) =>
builder.setName(this.name).setDescription(this.description).addStringOption((option) => option.setName('game').setDescription('Provide a game to add to gaming-list').setRequired(true)));
}

// slash command
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
const nameOfGameOld = interaction.options.getString('game');
await interaction.reply({
content: `Looking for game "${nameOfGameOld}"`
});

// TODO: find ID programmatically rather than set it here
const channel = await interaction.guild?.channels.cache.get(ValidIdIsHere);

// Should never happen as long as ID is provided manually
if (channel?.type !== ChannelType.GuildForum) {
return;
}

const response = await fetch(`https://api.steampowered.com/ISteamApps/GetAppList/v2?format=json`);
const { applist } = await response.json();
const results = applist.apps.filter((app: any) => app.name === nameOfGameOld);

if (!results || results.length === 0) {
return await interaction.editReply({
content: 'Could not find any games matching your query!'
});
}
return await interaction.editReply({ content: `Created an entry for "${nameOfGameOld}"` });
}
}
12 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/12/2023 in #sapphire-support
Failed to overwrite global application commands
Well I'm not trying to register any equally named commands and before enabling BulkOverwrite, I didn't have this issue.
12 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/12/2023 in #sapphire-support
Failed to overwrite global application commands
I'd highly appreciate any help. :)
12 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/12/2023 in #sapphire-support
Failed to overwrite global application commands
I've only got two command files in my commands directory. I suspected previous slash commands being an issue, but I've tried manually deleting those through the REST API to no avail.
12 replies
SIASapphire - Imagine a framework
Created by Yhya on 1/9/2023 in #sapphire-support
How to make auto idhints?
Ahh, thanks for pointing out that bit of the documentation!
32 replies
SIASapphire - Imagine a framework
Created by Yhya on 1/9/2023 in #sapphire-support
How to make auto idhints?
Sorry Vladdy, would you mind elaborating on this? Where and how would you do that?
32 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
Managed to get this to work with your initial input and v4! Thank you so much, @Rhys. 🥰
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
Thank you! 🙂
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
Oh! I just started using Sapphire yesterday, so I guess I'm lucky since v4 seems to be dropping today!? 😄
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
Oh I just pasted the ID in directly for now.
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
Additionally, I realized that I'm not just trying to send a text message, but create a thread in a forum channel. Would this approach still work with that? I'll figure that bit out myself! Don't wanna overstay my welcome.
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
I suppose this is an issue with the typescript setup? I knew I should've just used JS to keep it simple... 😄
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
const target= await interaction.guild?.channels.cache.get('id');
const target= await interaction.guild?.channels.cache.get('id');
Okay, so that does work! Thank you so far. Unfortunately, the following code throws some errors:
if (target?.isTextBased()) {
await target.send()
}
if (target?.isTextBased()) {
await target.send()
}
as Property 'isTextBased' does not exist on type 'GuildBasedChannel'. Property 'isTextBased' does not exist on type 'CategoryChannel'. and Property 'send' does not exist on type 'GuildBasedChannel'. Property 'send' does not exist on type 'CategoryChannel'. Edit: I was able to solve the errors by replacing isTextBased() with isText()
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
Oh, so you can get the id for the channel from the interaction parameter and then use send. Let me try that real quick, but it looks promising for sure.
17 replies
SIASapphire - Imagine a framework
Created by Freakspot on 1/8/2023 in #sapphire-support
Send message to specific channel from slash command
I'm looking to do B-ish: Send a message to a channel #logs, then reply to the slash command in the channel it was used in. Replying is easy, but sending to #logs - no idea.
17 replies