Maybe Ange
Maybe Ange
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 3/4/2024 in #djs-questions
Ping Bot
Guys, I can't seem to get the correct values, for example Discord API value is not good at all, it is displayed at -1ms, how can I fix this?
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Get latency'),
async execute(interaction) {
const StartTime = Date.now();

await interaction.reply("Établissement de la connexion en cours...").then(async msg => {
const endTime = Date.now();
const websocketPing = interaction.client.ws.ping;

const pingEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Latence du bot')
.setDescription('La latence du bot est définie par un point de terminaison entre l\'API Discord et le client. Cette valeur peut ne pas être stable en fonction du trafic et des requêtes :computer:')
.addFields(
{ name: 'Latence du bot', value: `${endTime - StartTime}ms`, inline: true },
{ name: 'Latence de l\'API Discord', value: `${websocketPing}ms`, inline: true },
{ name: 'Node', value: 'api.maybe-ange.com', inline: true }
);

await interaction.editReply({ content: " ", embeds: [pingEmbed] });
console.log(`Commande /ping exécutée par ${interaction.user.tag} dans ${interaction.channel.name} (${interaction.guild.name})`);
});
},
};
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Get latency'),
async execute(interaction) {
const StartTime = Date.now();

await interaction.reply("Établissement de la connexion en cours...").then(async msg => {
const endTime = Date.now();
const websocketPing = interaction.client.ws.ping;

const pingEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Latence du bot')
.setDescription('La latence du bot est définie par un point de terminaison entre l\'API Discord et le client. Cette valeur peut ne pas être stable en fonction du trafic et des requêtes :computer:')
.addFields(
{ name: 'Latence du bot', value: `${endTime - StartTime}ms`, inline: true },
{ name: 'Latence de l\'API Discord', value: `${websocketPing}ms`, inline: true },
{ name: 'Node', value: 'api.maybe-ange.com', inline: true }
);

await interaction.editReply({ content: " ", embeds: [pingEmbed] });
console.log(`Commande /ping exécutée par ${interaction.user.tag} dans ${interaction.channel.name} (${interaction.guild.name})`);
});
},
};
7 replies
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 3/4/2024 in #djs-voice
Delete voice channel if 0 user
Guys, could anyone help me make sure the bot doesn't delete the channel if someone is there? At the moment it works, but it doesn't check if anyone has entered since the command was executed, so it deletes it! I'm not very good at API yet, I'm doing my best...
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
intents: [
GatewayIntentBits.GuildVoiceStates
],
});

setTimeout(async () => {
if (channel.members.size === 0) {
await channel.delete();
const emptyChannelEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Salon vocal vide supprimé :x:')
.setDescription(`Le salon vocal ${channel.name} a été supprimé car il était vide.`);
await interaction.channel.send({ embeds: [emptyChannelEmbed] });
}
}, 10000);
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
intents: [
GatewayIntentBits.GuildVoiceStates
],
});

setTimeout(async () => {
if (channel.members.size === 0) {
await channel.delete();
const emptyChannelEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Salon vocal vide supprimé :x:')
.setDescription(`Le salon vocal ${channel.name} a été supprimé car il était vide.`);
await interaction.channel.send({ embeds: [emptyChannelEmbed] });
}
}, 10000);
36 replies
CC#
Created by Maybe Ange on 5/5/2023 in #help
❔ Just a question
13 replies
CC#
Created by Maybe Ange on 5/4/2023 in #help
❔ [FIX} Csharp & Python / WPF APP
I have a problem with this code, in fact I have a button on my WPF software and when I click on it it executes a separate python script in another file. The problem is that the software returns me my error I made in "Try" and tells me that it can't find the file and it can't run it, yet I don't understand the path is ok , can someone help me?
private void Button_Click(object sender, RoutedEventArgs e)
{
string pythonPath = @"C:\Program Files\Python\Python39\python.exe";
string scriptPath = @"D:\Documents\Script security network\Software Box\Software\Reload Box\scripts\reload-no-time.py";

try
{
if (!File.Exists(scriptPath))
{
throw new FileNotFoundException("Le fichier de script n'existe pas", scriptPath);
}
}
catch (FileNotFoundException ex)
{
MessageBox.Show($"Erreur : {ex.Message}");
return;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
string pythonPath = @"C:\Program Files\Python\Python39\python.exe";
string scriptPath = @"D:\Documents\Script security network\Software Box\Software\Reload Box\scripts\reload-no-time.py";

try
{
if (!File.Exists(scriptPath))
{
throw new FileNotFoundException("Le fichier de script n'existe pas", scriptPath);
}
}
catch (FileNotFoundException ex)
{
MessageBox.Show($"Erreur : {ex.Message}");
return;
}
49 replies
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 4/6/2023 in #djs-questions
/stop Music
Good morning, I have a problem with the STOP command not working for my bot in JS. I tried several things but still nothing. It's not a module import problem, I already have everything.
2 replies
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 3/31/2023 in #djs-questions
This code no longer works when it worked before!
I don't understand why the code doesn't work anymore, the bot joins the room, but no sound comes out, no apparent error. Idea?
5 replies
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 3/30/2023 in #djs-questions
Same post after updating discordjs channel.isText
9 replies
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 3/27/2023 in #djs-questions
Cannot read properties of undefined (reading 'BanMembers')
24 replies
DIAdiscord.js - Imagine an app
Created by Maybe Ange on 1/14/2023 in #djs-questions
Discord bot that disconnects after a few minutes/hours
Hello, I have an official Apex Legends discord server admin who gave me the bot they developed for their servers. The bot displays and updates every minute to show the status of Apex Legends game servers. I have a problem with the bot today for some reason! The bot disconnects on its own after a few hours or sometimes a few minutes. I managed to have logs but I don't understand, if people can help me that would be cool. (The admin also doesn't understand wh
9 replies