Disuqi
Disuqi
Explore posts from servers
SIASapphire - Imagine a framework
Created by Disuqi on 5/11/2024 in #sapphire-support
Autofill message textbox
Is it possible to autofill the message text box upon the press of a button. The idea is to have a button which when pressed auto fills the text box with the intial part of the command (this command also has some options which the user needs to set)
4 replies
SIASapphire - Imagine a framework
Created by Disuqi on 5/11/2024 in #sapphire-support
Autocomplete TextInput
Is it possible to suggest something for the text input? https://discord.js.org/docs/packages/discord.js/14.15.2/TextInputBuilder:Class
10 replies
SIASapphire - Imagine a framework
Created by Disuqi on 5/6/2024 in #sapphire-support
API References
Is there a webpage containing all API References for the framework. For example InteractionHandler, all its functions, their purpose, return values, what arguments they take in etc... So a detailed technical page. I can see sapphire/shapeshift and some other stuff have it, but not framework. Which is the main one.
12 replies
SIASapphire - Imagine a framework
Created by Disuqi on 8/31/2023 in #sapphire-support
Command.ChatInputCommandInteraction GuildMember.voice not updating
public async play(interaction : Command.ChatInputCommandInteraction)
{
const interactionGuildId = interaction.guildId;
const member = interaction.member as GuildMember;
if (interactionGuildId == null || member == null)
{
await interaction.reply("This command can only be used in a server");
return;
}

const voiceState = member.voice;
if (voiceState == null || voiceState.channel == null)
{
//I get this message even when in a voice channel
await interaction.reply("You must be in a voice channel to use this command");
return;
}
public async play(interaction : Command.ChatInputCommandInteraction)
{
const interactionGuildId = interaction.guildId;
const member = interaction.member as GuildMember;
if (interactionGuildId == null || member == null)
{
await interaction.reply("This command can only be used in a server");
return;
}

const voiceState = member.voice;
if (voiceState == null || voiceState.channel == null)
{
//I get this message even when in a voice channel
await interaction.reply("You must be in a voice channel to use this command");
return;
}
If before starting my bot I am in a voice channel, then it works as expected, but when I start the bot, and then join a voice channel, it doesn't work. interaction.member.voice.channel is null, as well as interaction.member.voice.channelId
2 replies
SIASapphire - Imagine a framework
Created by Disuqi on 8/31/2023 in #sapphire-support
Unsync slash commands
Is there a way to delete previously synced commands. I have some slash commands created in the past with this bot, I have now deleted those commands (their files), but on the discord server, they are still there, and I can still call them, they don't work i get Invalid interaction application command which is fine, but I dont want them there.
9 replies
SIASapphire - Imagine a framework
Created by Disuqi on 8/30/2023 in #sapphire-support
Error [EMPTY_MODULE]: A compatible class export was not found.
Not sure what's causing this error Here is my code and file tree
└───src
├───apis
├───commands
└───quran-player
├───data
├───private
└───utils
└───src
├───apis
├───commands
└───quran-player
├───data
├───private
└───utils
import { AudioPlayer, AudioPlayerStatus, NoSubscriberBehavior, createAudioResource } from "@discordjs/voice";

export class QuranTrack
{
public readonly name : string;
public readonly url : string;
constructor(name : string, url : string)
{
this.name = name;
this.url = url;
}
}

export class QuranAudioPlayer extends AudioPlayer
{
private _queue : QuranTrack[];
private _currentTrack : QuranTrack;

constructor()
{
super({ behaviors: { noSubscriber: NoSubscriberBehavior.Pause, maxMissedFrames: 0 }});
this.on(AudioPlayerStatus.Idle, this.next);
}

get currentTrackName() : QuranTrack
{
return this._currentTrack;
}

get queue() : QuranTrack[]
{
return this._queue;
}

public async playQuran(track : QuranTrack) : Promise<boolean>
{
const resource = createAudioResource(track.url);
try
{
this.play(resource);
this._currentTrack = track;
return true;
}catch (error)
{
return false;
}
}

public async next()
{
if (this._queue.length > 0)
{
const track = this._queue.shift();
this.playQuran(track);
}
}

public async enqueue(track : QuranTrack)
{
this._queue.push(track);
if (this.state.status == AudioPlayerStatus.Idle)
{
this.next();
}
}
}
import { AudioPlayer, AudioPlayerStatus, NoSubscriberBehavior, createAudioResource } from "@discordjs/voice";

export class QuranTrack
{
public readonly name : string;
public readonly url : string;
constructor(name : string, url : string)
{
this.name = name;
this.url = url;
}
}

export class QuranAudioPlayer extends AudioPlayer
{
private _queue : QuranTrack[];
private _currentTrack : QuranTrack;

constructor()
{
super({ behaviors: { noSubscriber: NoSubscriberBehavior.Pause, maxMissedFrames: 0 }});
this.on(AudioPlayerStatus.Idle, this.next);
}

get currentTrackName() : QuranTrack
{
return this._currentTrack;
}

get queue() : QuranTrack[]
{
return this._queue;
}

public async playQuran(track : QuranTrack) : Promise<boolean>
{
const resource = createAudioResource(track.url);
try
{
this.play(resource);
this._currentTrack = track;
return true;
}catch (error)
{
return false;
}
}

public async next()
{
if (this._queue.length > 0)
{
const track = this._queue.shift();
this.playQuran(track);
}
}

public async enqueue(track : QuranTrack)
{
this._queue.push(track);
if (this.state.status == AudioPlayerStatus.Idle)
{
this.next();
}
}
}
20 replies
SIASapphire - Imagine a framework
Created by Disuqi on 8/30/2023 in #sapphire-support
Sync Slash Commands with one Guild
Hello, I have a test server which i use to test my bots, I am new to sapphire, and by reading the docs, I couldn't find a way to make the app sync the commands to a single guild/server. I do not want to sync with all servers as I noticed that is slow and takes a few minutes, whereas when i sync with one server (my server) it's almost immediate. Can you do that in sapphire? Please help
8 replies