Обкуренный
Обкуренный
DIAdiscord.js - Imagine an app
Created by Обкуренный on 2/22/2024 in #djs-questions
The button does not appear
After applying the command, only Embed, but there is no button Code - https://pastebin.com/jztz1uTJ
6 replies
DIAdiscord.js - Imagine an app
Created by Обкуренный on 2/21/2024 in #djs-questions
Error Verified System
3 replies
DIAdiscord.js - Imagine an app
Created by Обкуренный on 9/30/2023 in #djs-questions
Help
Code - https://pastebin.com/s8s53Cqj Error -
C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16
Intents.FLAGS.GUILDS,
^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16:17)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.17.0
C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16
Intents.FLAGS.GUILDS,
^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
at new MusicBot (C:\Users\User\Desktop\Музыкальный Бот\src\structures\MusicClient.js:16:17)
at Object.<anonymous> (C:\Users\User\Desktop\Музыкальный Бот\src\index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Node.js v18.17.0
9 replies
DIAdiscord.js - Imagine an app
Created by Обкуренный on 9/29/2023 in #djs-questions
Delete the message to clicked button
No description
3 replies
DIAdiscord.js - Imagine an app
Created by Обкуренный on 8/6/2023 in #djs-questions
MongoDB is not working
I installed the mongoose library and entered the DB connection into the code, but it does not work, there are no errors in the console
const mongoose = require('mongoose');
const mongodbURL = process.env.MONGODBURL;
mongoose.set('strictQuery', false);


module.exports = {
name: 'ready',
once: true,
async execute(client) {
console.log('Ready!');

if (!mongodbURL) return;

await mongoose.connect(mongodbURL || '', {
keepAlive: true,
useNewUrlParser: true,
useUnifiedTopology: true
})


if (mongoose.connect) {
console.log('MongoDB ready!')
}

.........
};
const mongoose = require('mongoose');
const mongodbURL = process.env.MONGODBURL;
mongoose.set('strictQuery', false);


module.exports = {
name: 'ready',
once: true,
async execute(client) {
console.log('Ready!');

if (!mongodbURL) return;

await mongoose.connect(mongodbURL || '', {
keepAlive: true,
useNewUrlParser: true,
useUnifiedTopology: true
})


if (mongoose.connect) {
console.log('MongoDB ready!')
}

.........
};
4 replies
DIAdiscord.js - Imagine an app
Created by Обкуренный on 8/4/2023 in #djs-questions
Buttons
I made a team for voting, it works. I made the code to make the buttons work - they don't work Command
const { SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('poll')
.setDescription('Создать голосование')
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption(options => options
.setName("question")
.setDescription("Укажите вопрос")
.setRequired(true)
),
/**
*
* @param {ChatInputCommandInteraction} interaction
*/
async execute(interaction) {
const pollQuestion = interaction.options.getString("question");

const pollEmbed = new EmbedBuilder()
.setTitle("Fury Голосование 📢")
.setDescription("**Вопрос:**\n" + pollQuestion)
.setImage("https://i.postimg.cc/jdZpyQ90/Line-1123.png")
.addFields([
{name: "Да", value: "0", inline: true},
{name: "Нет", value: "0", inline: true}
])
.setColor('Orange');

const replyObject = await interaction.reply({embeds: [pollEmbed], fetchReply: true});

const pollButtons = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Yes')
.setCustomId(`Poll-Yes-${replyObject.id}`)
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setLabel('No')
.setCustomId(`Poll-No-${replyObject.id}`)
.setStyle(ButtonStyle.Danger)
)

interaction.editReply({components: [pollButtons]});
}
}
const { SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('poll')
.setDescription('Создать голосование')
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption(options => options
.setName("question")
.setDescription("Укажите вопрос")
.setRequired(true)
),
/**
*
* @param {ChatInputCommandInteraction} interaction
*/
async execute(interaction) {
const pollQuestion = interaction.options.getString("question");

const pollEmbed = new EmbedBuilder()
.setTitle("Fury Голосование 📢")
.setDescription("**Вопрос:**\n" + pollQuestion)
.setImage("https://i.postimg.cc/jdZpyQ90/Line-1123.png")
.addFields([
{name: "Да", value: "0", inline: true},
{name: "Нет", value: "0", inline: true}
])
.setColor('Orange');

const replyObject = await interaction.reply({embeds: [pollEmbed], fetchReply: true});

const pollButtons = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Yes')
.setCustomId(`Poll-Yes-${replyObject.id}`)
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setLabel('No')
.setCustomId(`Poll-No-${replyObject.id}`)
.setStyle(ButtonStyle.Danger)
)

interaction.editReply({components: [pollButtons]});
}
}
4 replies
DIAdiscord.js - Imagine an app
Created by Обкуренный on 8/4/2023 in #djs-questions
Help
I wanted to make an eventHendler using a table. I did everything according to the guide on YouTube, but it doesn't work, there are no errors. index.js
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js");
const { Guilds, GuildMembers, GuildMessages } = GatewayIntentBits;
const { User, Message, GuildMember, ThreadMember } = Partials;

const client = new Client({
intents: [Guilds, GuildMembers, GuildMessages],
partials: [User, Message, GuildMember, ThreadMember]
});

const { loadEvents } = require("./Handlers/eventHandler");

client.config = require("./config.json");
client.events = new Collection();

loadEvents(client);

client
.login(client.config.token)
.then( () => {
console.log(`client logged is as ${client.user.username}`);
client.user.setActivity(`with ${client.guilds.cache.size} guilds(s)`);
})
.catch((err) => console.log(err));
const { Client, GatewayIntentBits, Partials, Collection } = require("discord.js");
const { Guilds, GuildMembers, GuildMessages } = GatewayIntentBits;
const { User, Message, GuildMember, ThreadMember } = Partials;

const client = new Client({
intents: [Guilds, GuildMembers, GuildMessages],
partials: [User, Message, GuildMember, ThreadMember]
});

const { loadEvents } = require("./Handlers/eventHandler");

client.config = require("./config.json");
client.events = new Collection();

loadEvents(client);

client
.login(client.config.token)
.then( () => {
console.log(`client logged is as ${client.user.username}`);
client.user.setActivity(`with ${client.guilds.cache.size} guilds(s)`);
})
.catch((err) => console.log(err));
fileLoader.js
const { glob } = require("glob");
const { promisify } = require("util");
const proGlob = promisify(glob);

async function loadFiles(dirName){
const Files = await proGlob(`${process.cwd().replace(/\\/g, "/")}/${dirName}/**/*.js`);
Files.forEach((file) => delete require.cache[require.resolve(file)]);
return Files;
}

module.exports = { loadFiles }
const { glob } = require("glob");
const { promisify } = require("util");
const proGlob = promisify(glob);

async function loadFiles(dirName){
const Files = await proGlob(`${process.cwd().replace(/\\/g, "/")}/${dirName}/**/*.js`);
Files.forEach((file) => delete require.cache[require.resolve(file)]);
return Files;
}

module.exports = { loadFiles }
8 replies