Я знаю, это звучит глупо, но я не могу понять, как это сделать, вот код и .env, которые я использую
Код: Выделить всё
const { EmbedBuilder } = require('discord.js');
// Settings for shame and spoiler chats
const CONFIG = {
MPREG: {
ID: process.env.MPREG_CHANNEL_ID,
LIMIT: Number(process.env.MPREG_REACTION_LIMIT),
EMOJI: process.env.MPREG_EMOJI
},
CHAIR: {
ID: process.env.MPREG_CHANNEL_ID,
LIMIT: Number(process.env.CHAIR_REACTION_LIMIT),
EMOJI: process.env.CHAIR_EMOJI
}
}
module.exports = async (reaction) => {
if (reaction.partial) {
try { await reaction.fetch(); } catch (err) { return; }
}
if (reaction.message.author.bot) return;
const { emoji, count, message } = reaction;
// Access client through the message object
const botClient = message.client;
if ((emoji.name === CONFIG.MPREG.EMOJI && count == CONFIG.MPREG.LIMIT) && (emoji.name === CONFIG.CHAIR.EMOJI && count == CONFIG.CHAIR.LIMIT)) {
const mpregchairChannel = botClient.channels.cache.get(CONFIG.MPREG.ID);
if (!mpregchairChannel) return;
const embedMpreg = new EmbedBuilder()
.setColor(0xEDDC24)
.setAuthor({ name: message.author.tag, iconURL: message.author.displayAvatarURL() })
.setDescription(message.content || " [No text content] ")
.addFields({ name: 'Channel', value: `${message.channel}`, inline: true })
.setTimestamp()
.setFooter({ text: `Message ID: ${message.id}` });
if (message.attachments.size > 0) {
embedMpreg.setImage(message.attachments.first().proxyURL);
}
await mpregchairChannel.send({ content: `🫃🪑 | ${message.url}`, embeds: [embedMpreg] })
}
};
Код: Выделить всё
MPREG_CHANNEL_ID=1457075639298429041
MPREG_EMOJI=🫃
CHAIR_EMOJI=🪑
MPREG_REACTION_LIMIT=1
CHAIR_REACTION_LIMIT=1
Я использую discord.js 14.25.1 и dotenv 17.2.3
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/798 ... -and-count
Мобильная версия