Avery
Avery
Explore posts from servers
SIASapphire - Imagine a framework
Created by Avery on 6/29/2024 in #sapphire-support
Subcommands Broken
solved
5 replies
SIASapphire - Imagine a framework
Created by Avery on 6/29/2024 in #sapphire-support
Subcommands Broken
omfg im so dumb. I did messageRun instead of chatInputRun
5 replies
SIASapphire - Imagine a framework
Created by Avery on 6/29/2024 in #sapphire-support
Subcommands Broken
5 replies
DIAdiscord.js - Imagine an app
Created by Avery on 5/28/2024 in #djs-voice
Playing Base64 Through Voice
the bot isn’t speaking
8 replies
DIAdiscord.js - Imagine an app
Created by Avery on 5/28/2024 in #djs-voice
Playing Base64 Through Voice
const { EmbedBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder, Colors } = require("discord.js");
const ttsBot = require("discord-tts");
const voice = require("@discordjs/voice");
const { Buffer } = require("buffer");
const ffmpeg = require("fluent-ffmpeg");

const RTO = {
TEXT: "1244815994623492127",
VC: "1244816012994416680"
};

let voiceConnection;
let audioPlayer = new voice.createAudioPlayer();

const emergency = interaction.options.getString("emergency");
const location = interaction.options.getString("location");
const user = interaction.member.nickname || interaction.user.username;

const textChannel = interaction.guild.channels.cache.get(RTO.TEXT);
const voiceChannel = interaction.guild.channels.cache.get(RTO.VC);

const stream = ttsBot.getVoiceStream(emergency);
const audioResource = voice.createAudioResource(stream, {
inputType: voice.StreamType.Arbitrary,
inlineVolume: true
});

if (
!voiceConnection ||
voiceConnection?.status === voice.VoiceConnectionStatus.Disconnected
) {
voiceConnection = voice.joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator
});
console.debug(voiceConnection);

voiceConnection = await voice.entersState(
voiceConnection,
voice.VoiceConnectionStatus.Connecting,
5_000
);
console.debug(voiceConnection);
}

if (voiceConnection.status === voice.VoiceConnectionStatus.Ready) {
voiceConnection.subscribe(player);
player.play(audioResource);
console.debug(voiceConnection);
}
}
};
const { EmbedBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder, Colors } = require("discord.js");
const ttsBot = require("discord-tts");
const voice = require("@discordjs/voice");
const { Buffer } = require("buffer");
const ffmpeg = require("fluent-ffmpeg");

const RTO = {
TEXT: "1244815994623492127",
VC: "1244816012994416680"
};

let voiceConnection;
let audioPlayer = new voice.createAudioPlayer();

const emergency = interaction.options.getString("emergency");
const location = interaction.options.getString("location");
const user = interaction.member.nickname || interaction.user.username;

const textChannel = interaction.guild.channels.cache.get(RTO.TEXT);
const voiceChannel = interaction.guild.channels.cache.get(RTO.VC);

const stream = ttsBot.getVoiceStream(emergency);
const audioResource = voice.createAudioResource(stream, {
inputType: voice.StreamType.Arbitrary,
inlineVolume: true
});

if (
!voiceConnection ||
voiceConnection?.status === voice.VoiceConnectionStatus.Disconnected
) {
voiceConnection = voice.joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator
});
console.debug(voiceConnection);

voiceConnection = await voice.entersState(
voiceConnection,
voice.VoiceConnectionStatus.Connecting,
5_000
);
console.debug(voiceConnection);
}

if (voiceConnection.status === voice.VoiceConnectionStatus.Ready) {
voiceConnection.subscribe(player);
player.play(audioResource);
console.debug(voiceConnection);
}
}
};
8 replies
DIAdiscord.js - Imagine an app
Created by Avery on 5/28/2024 in #djs-voice
Playing Base64 Through Voice
Nvm, new code: doesn't work!!!
8 replies
DIAdiscord.js - Imagine an app
Created by Avery on 5/28/2024 in #djs-voice
Playing Base64 Through Voice
Why isn't this working?
8 replies
DIAdiscord.js - Imagine an app
Created by Avery on 5/28/2024 in #djs-voice
Playing Base64 Through Voice
Code:
const { EmbedBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder, Colors } = require("discord.js");
const gtts = require("google-tts-api");
const voice = require("@discordjs/voice");
const { Buffer } = require("buffer");

const RTO = {
TEXT: "1244815994623492127",
VC: "1244816012994416680"
};

const emergency = interaction.options.getString("emergency");
const location = interaction.options.getString("location");
const user = interaction.member.nickname || interaction.user.username;

const textChannel = interaction.guild.channels.cache.get(RTO.TEXT);
const voiceChannel = interaction.guild.channels.cache.get(RTO.VC);

const tts = await gtts.getAudioBase64(
`911 call from ${user}. ${emergency}. Location: ${location}`
);

console.log(tts);

await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor(Colors.Green)
.setTitle("Your call has been dispatched")
.setDescription(
`Your emergency has been dispatched to RTO. Officers will be enroute shortly.`
)
],
ephemeral: true
});

await textChannel.send({
embeds: [
new EmbedBuilder()
.setColor(Colors.Blurple)
.setTitle("Incoming 911 Call")
.setDescription(
`**Caller:** ${user}\n**Emergency:** ${emergency}\n**Location:** ${location}`
)
.setFooter({
text: "Emergency has also been dispatched to the voice channel."
})
]
});

voice.joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator
});

const player = voice.createAudioPlayer();

const resource = voice.createAudioResource(tts, {
inputType: voice.StreamType.Arbitrary
});

player.play(resource);
}
const { EmbedBuilder } = require("@discordjs/builders");
const { SlashCommandBuilder, Colors } = require("discord.js");
const gtts = require("google-tts-api");
const voice = require("@discordjs/voice");
const { Buffer } = require("buffer");

const RTO = {
TEXT: "1244815994623492127",
VC: "1244816012994416680"
};

const emergency = interaction.options.getString("emergency");
const location = interaction.options.getString("location");
const user = interaction.member.nickname || interaction.user.username;

const textChannel = interaction.guild.channels.cache.get(RTO.TEXT);
const voiceChannel = interaction.guild.channels.cache.get(RTO.VC);

const tts = await gtts.getAudioBase64(
`911 call from ${user}. ${emergency}. Location: ${location}`
);

console.log(tts);

await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor(Colors.Green)
.setTitle("Your call has been dispatched")
.setDescription(
`Your emergency has been dispatched to RTO. Officers will be enroute shortly.`
)
],
ephemeral: true
});

await textChannel.send({
embeds: [
new EmbedBuilder()
.setColor(Colors.Blurple)
.setTitle("Incoming 911 Call")
.setDescription(
`**Caller:** ${user}\n**Emergency:** ${emergency}\n**Location:** ${location}`
)
.setFooter({
text: "Emergency has also been dispatched to the voice channel."
})
]
});

voice.joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator
});

const player = voice.createAudioPlayer();

const resource = voice.createAudioResource(tts, {
inputType: voice.StreamType.Arbitrary
});

player.play(resource);
}
8 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
the value doesn't set the contents
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
MonacoEditor, is the WebView2; sorry
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
everything works now, but i'm not sure if you'll be able to help me with another error.
private async void MonacoEditor_NavigationCompleted(WebView2 sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs args)
{
await Task.Delay(500); // Use asynchronous delay
System.Diagnostics.Debug.WriteLine(fileContents);
try
{
await MonacoEditor.ExecuteScriptAsync("monaco.editor.getModels()[0].setValue(\"" + fileContents + "\");");
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Script execution error: " + ex.Message);
}

System.Diagnostics.Debug.WriteLine("possibly set value");
}
private async void MonacoEditor_NavigationCompleted(WebView2 sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs args)
{
await Task.Delay(500); // Use asynchronous delay
System.Diagnostics.Debug.WriteLine(fileContents);
try
{
await MonacoEditor.ExecuteScriptAsync("monaco.editor.getModels()[0].setValue(\"" + fileContents + "\");");
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Script execution error: " + ex.Message);
}

System.Diagnostics.Debug.WriteLine("possibly set value");
}
The file contents logs, and the "possibly set value" also logs. But, the monaco script doesn't work. When I manually execute the JS in the devtools console, that appears to work; but the executescriptasync isn't doing anything. I did the task delay to wait for the editor to load once navigation was completed.
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
holy, it works now tysm!
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
this is nvSample_Loaded_1
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
Yeah, i'm creating the navigation view in the actual XAML. Not in the code. https://hastebin.skyra.pw/digojikiya.csharp had to find a hastebin service to upload the code to. too big for discord
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
if it's possible
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
that's my intention
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
yeah, when I receive a message from the websocket, it adds the item
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
let me try that, with out the dispatcher
31 replies
CC#
Created by Avery on 7/5/2023 in #help
❔ Object reference not sent to an instance of an object
because different thread or whatever
31 replies