Dmitry Batkovich
Dmitry Batkovich
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 9/5/2023 in #djs-questions
how do I change the topic of stage Instances in the scene channel?
there is a channel this is a scene it has stage Instances set how to change the topic for this stage Instances the channel.stageInstance.topic = "New Theme" method does not work
3 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 9/5/2023 in #djs-questions
Discord JS music playback via ffmpeg on stage
I understand that in ffmpeg I pass the path to the file and how do I redirect the music playback stream to the voice of the bot that is on stage?
5 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 9/5/2023 in #djs-questions
How do I check that the bot is connected to the stage and releases on it?
How do I check that the bot is connected to the stage and releases on it? To avoid catching an exception when connecting to a channel like here:
6 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 9/5/2023 in #djs-questions
Inline field title
Hi, I want to make an Inline Title in my Embed object, as in the example of one of my kicks with a timeout error, what could be the problem?
6 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/22/2023 in #djs-questions
ExpectedConstraintError: Invalid number value
Even I can't figure out what he doesn't like
9 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/21/2023 in #djs-questions
How to close scene?
so createStageInstance creates a scene, as I understand it now, how do I close it, I disconnect the bot via connection.disconnect(), however, the scene does not close, as I understand it, I need to send an empty topic to the createStageInstance channel or which method to call?
4 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/21/2023 in #djs-questions
Is it possible to make a bot that opens the stage and starts performing?
Is it possible to immediately make the bot connect to the scene by ID and immediately open the scene with the specified name?
24 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/20/2023 in #djs-questions
Is it possible to send a message later so that it is sent as if it was sent by the user?
for example, when sending a message from the bot message.channel.send , change the avatar and nickname somehow and send
async function sendMessageAsUser(channel, content, username, avatarURL)
{
const messageOptions =
{
content: content,
username: username,
avatarURL: avatarURL,
flags: MessageFlags.Crossposted
};

const message = await channel.send(messageOptions);
return message;
}
async function sendMessageAsUser(channel, content, username, avatarURL)
{
const messageOptions =
{
content: content,
username: username,
avatarURL: avatarURL,
flags: MessageFlags.Crossposted
};

const message = await channel.send(messageOptions);
return message;
}
9 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/20/2023 in #djs-questions
how do I set the send Typing() timeout?
I have a bot that sends a response to requests for a long time, I would like send Typing to work until the bot responds, now sendTyping works for 5-10 seconds and disappears
17 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/19/2023 in #djs-questions
How do I create buttons under messages?
I have a message how to link buttons to it? I understand MessageActionRow, Message Button, Message Embed are outdated
const { Client, Intents, MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.DIRECT_MESSAGE_REACTIONS] });

client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});

client.on('guildMemberAdd', async member => {
const flags = [
{ name: 'Test1', emoji: '🇷🇺' },
{ name: 'Test2', emoji: '🇺🇸' },
{ name: 'Test3', emoji: '🇩🇪' },
{ name: 'Test4', emoji: '🇹🇷' },
{ name: 'Test5', emoji: '🇮🇷' },
{ name: 'Test6', emoji: '🇺🇦' },
{ name: 'Test7', emoji: '🇯🇵' }
];

const row = new MessageActionRow();
for (const flag of flags) {
const button = new MessageButton()
.setCustomId(`language_${flag.name}`)
.setLabel(flag.name)
.setStyle('PRIMARY')
.setEmoji(flag.emoji);
row.addComponents(button);
}

const embed = new MessageEmbed()
.setTitle('Test Title:')
.setDescription('Test Message')
.setColor('#0099ff')
.setTimestamp();

try {
const dmChannel = await member.createDM();
await dmChannel.send({ embeds: [embed], components: [row] });
} catch (error) {
console.error('Error sending message:', error);
}
});

client.on('interactionCreate', async interaction => {
if (!interaction.isButton()) return;

const selectedLanguage = interaction.customId.split('_')[1];
await interaction.reply(`Your Answer: ${selectedLanguage}`);
});

client.login('TOKEN');
const { Client, Intents, MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.DIRECT_MESSAGE_REACTIONS] });

client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});

client.on('guildMemberAdd', async member => {
const flags = [
{ name: 'Test1', emoji: '🇷🇺' },
{ name: 'Test2', emoji: '🇺🇸' },
{ name: 'Test3', emoji: '🇩🇪' },
{ name: 'Test4', emoji: '🇹🇷' },
{ name: 'Test5', emoji: '🇮🇷' },
{ name: 'Test6', emoji: '🇺🇦' },
{ name: 'Test7', emoji: '🇯🇵' }
];

const row = new MessageActionRow();
for (const flag of flags) {
const button = new MessageButton()
.setCustomId(`language_${flag.name}`)
.setLabel(flag.name)
.setStyle('PRIMARY')
.setEmoji(flag.emoji);
row.addComponents(button);
}

const embed = new MessageEmbed()
.setTitle('Test Title:')
.setDescription('Test Message')
.setColor('#0099ff')
.setTimestamp();

try {
const dmChannel = await member.createDM();
await dmChannel.send({ embeds: [embed], components: [row] });
} catch (error) {
console.error('Error sending message:', error);
}
});

client.on('interactionCreate', async interaction => {
if (!interaction.isButton()) return;

const selectedLanguage = interaction.customId.split('_')[1];
await interaction.reply(`Your Answer: ${selectedLanguage}`);
});

client.login('TOKEN');
7 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/18/2023 in #djs-questions
How do I send Discord Embed?
I have a code that sends Discord Embed however does not see the MessageEmbed namespace what could be wrong?
// Import the necessary modules
const { Client, IntentsBitField, Partials, MessageEmbed } = require('discord.js');

// Create a new instance of a Discord client
const client = new Discord.Client();

// Define your bot's token here
const token = 'bottoken';

// Set up an event listener for when the bot is ready
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});

// Set up an event listener for incoming messages
client.on('messageCreate', async message => {
// Ignore messages from bots
if (message.author.bot) return;

// Create a new embedded message
const embed = new MessageEmbed()
.setColor('#0099ff') // Set the color of the embed
.setTitle('Example Embed') // Set the title of the embed
.setDescription('This is an example of an embedded message.') // Set the description of the embed
.setImage('https://example.com/image.png') // Set an image for the embed
.setTimestamp(); // Add a timestamp to the embed

// Send the embedded message to the same channel
message.channel.send(embed);
});

// Log in to Discord with your app's token
client.login(token);
// Import the necessary modules
const { Client, IntentsBitField, Partials, MessageEmbed } = require('discord.js');

// Create a new instance of a Discord client
const client = new Discord.Client();

// Define your bot's token here
const token = 'bottoken';

// Set up an event listener for when the bot is ready
client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});

// Set up an event listener for incoming messages
client.on('messageCreate', async message => {
// Ignore messages from bots
if (message.author.bot) return;

// Create a new embedded message
const embed = new MessageEmbed()
.setColor('#0099ff') // Set the color of the embed
.setTitle('Example Embed') // Set the title of the embed
.setDescription('This is an example of an embedded message.') // Set the description of the embed
.setImage('https://example.com/image.png') // Set an image for the embed
.setTimestamp(); // Add a timestamp to the embed

// Send the embedded message to the same channel
message.channel.send(embed);
});

// Log in to Discord with your app's token
client.login(token);
ReferenceError: MessageEmbed is not defined
at Client.<anonymous> (D:\KJPiTechnologes\discordbots\moderator\src\index.js:69:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

TypeError: MessageEmbed is not a constructor
at Client.<anonymous> (D:\KJPiTechnologes\discordbots\moderator\src\index.js:69:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ReferenceError: MessageEmbed is not defined
at Client.<anonymous> (D:\KJPiTechnologes\discordbots\moderator\src\index.js:69:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

TypeError: MessageEmbed is not a constructor
at Client.<anonymous> (D:\KJPiTechnologes\discordbots\moderator\src\index.js:69:27)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
9 replies
DIAdiscord.js - Imagine an app
Created by Dmitry Batkovich on 8/18/2023 in #djs-questions
How do I get the bot to respond to DM messages that are written to it from the user?
I still can't find an example where there is an event that would trigger whenever a user writes a message to a bot in the DM
33 replies