3 Replies
d.js toolkit
d.js toolkit4w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Mussaplays.
Mussaplays.4w ago
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Permissions, EmbedBuilder } = require('discord.js');
const warningSchema = require("../../Schemas/warnSchema");

module.exports = {
data: new SlashCommandBuilder()
.setName("warnings")
.setDescription("Check a member's warnings")
.addUserOption(option =>
option.setName("user")
.setDescription("The member you want to check the warnings of")
.setRequired(true)),

async execute(interaction) {
const { options, guildId } = interaction;
const target = options.getUser("user");


const allWarnings = await warningSchema.find({ GuildID: guildId, UserID: target.id }, async (err, data) => {
if (err) throw err;
const embed = new EmbedBuilder();
if (data) {
embed.setColor("#0080FF")
.setDescription(`:white_check_mark: ${target.tag}'s warnings: \n${data.Content.map(
(w, i) => `**Warning ${i + 1}:**\n**Warning Moderator:** ${w.ExecutorTag}\n**Warn Reason:** ${w.Reason}`
).join('\n')}`);
interaction.reply({ embeds: [embed] });
} else {
const noWarnsEmbed = new EmbedBuilder()
.setColor("#0080FF")
.setDescription(`:white_check_mark: ${target.tag} has no warnings!`);
interaction.reply({ embeds: [noWarnsEmbed] });
}
});
}
};
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Permissions, EmbedBuilder } = require('discord.js');
const warningSchema = require("../../Schemas/warnSchema");

module.exports = {
data: new SlashCommandBuilder()
.setName("warnings")
.setDescription("Check a member's warnings")
.addUserOption(option =>
option.setName("user")
.setDescription("The member you want to check the warnings of")
.setRequired(true)),

async execute(interaction) {
const { options, guildId } = interaction;
const target = options.getUser("user");


const allWarnings = await warningSchema.find({ GuildID: guildId, UserID: target.id }, async (err, data) => {
if (err) throw err;
const embed = new EmbedBuilder();
if (data) {
embed.setColor("#0080FF")
.setDescription(`:white_check_mark: ${target.tag}'s warnings: \n${data.Content.map(
(w, i) => `**Warning ${i + 1}:**\n**Warning Moderator:** ${w.ExecutorTag}\n**Warn Reason:** ${w.Reason}`
).join('\n')}`);
interaction.reply({ embeds: [embed] });
} else {
const noWarnsEmbed = new EmbedBuilder()
.setColor("#0080FF")
.setDescription(`:white_check_mark: ${target.tag} has no warnings!`);
interaction.reply({ embeds: [noWarnsEmbed] });
}
});
}
};
MongooseError: Model.find() no longer accepts a callback
Mark
Mark4w ago
please make a post in #other-js-ts