Closed FxckingAngel closed 2 years ago
Have you tried putting it out of a array?
No I will try
I does not work with or without the array.
Can you send the embed code also
var em = new Discord.MessageEmbed()
.setTitle(Muted!
)
.setDescription(Admin has muted you!
)
.setColor(800080)
.setImage("https://i.pinimg.com/originals/93/4a/c2/934ac2e1254bfe067aff258f92260310.gif")
I'll look into this later today.
also here error sorry for not giving all info before asking
if (typeof data !== 'string') throw new error(errorMessage);
^
RangeError [EMBED_DESCRIPTION]: MessageEmbed description must be a string.
Oh. Ye that explains alot
This may work! message.channel.send({ embeds: this.format(this.options.muteMessage, message}))
for a catch
You can simply rely on the packages events... like warnAdd
on that event:
antiSpam.onEvent("warnAdd", (member) => {
//create your embed in here and send it to the log channel, or whichever channel you want.
//in my case here is my code:
const logChannel = member.guild.channels.cache.find(c => c.name.includes("mod-logs"));
if (logChannel) {
const embed = new MessageEmbed()
.setColor("#ff0000")
.setTitle("Member Warned")
.setThumbnail(member.guild.me.user.displayAvatarURL())
.setFooter({ text: member.guild.me.displayName, iconURL: member.guild.me.user.displayAvatarURL() })
.setTimestamp()
.setDescription(stripIndents`
**Warned member:** ${member} (${member.id})
**Warned By:** ${member.guild.me}
**Reason:** Spam`)
logChannel.send({text: '', embeds: embed});
}
});
@FxckingAngel Have you tried to using an actual string?
var em = new Discord.MessageEmbed()
.setTitle("Muted!")
.setDescription("Admin has muted you!")
.setColor(800080)
.setImage("https://i.pinimg.com/originals/93/4a/c2/934ac2e1254bfe067aff258f92260310.gif")
sorry for late reply they both work but for the first one need to fix this
antiSpam.on("warnAdd", (member) => {
const logChannel = member.guild.channels.cache.find(c => c.name.includes("mellie-logs"));
if (logChannel) {
const embed = new MessageEmbed()
.setColor("#800080")
.setTitle("Member Warned")
.setThumbnail(member.guild.me.user.displayAvatarURL())
.setFooter({ text: member.guild.me.displayName, iconURL: member.guild.me.user.displayAvatarURL() })
.setTimestamp()
.setDescription(`
**Warned member:** ${member} (${member.id})
**Warned By:** ${member.guild.me}
**Reason:** Spam`)
logChannel.send({embeds: [embed]});
}
});
yes but It won't send @Scraayp
You can simply rely on the packages events... like
warnAdd
on that event:antiSpam.onEvent("warnAdd", (member) => { //create your embed in here and send it to the log channel, or whichever channel you want. //in my case here is my code: const logChannel = member.guild.channels.cache.find(c => c.name.includes("mod-logs")); if (logChannel) { const embed = new MessageEmbed() .setColor("#ff0000") .setTitle("Member Warned") .setThumbnail(member.guild.me.user.displayAvatarURL()) .setFooter({ text: member.guild.me.displayName, iconURL: member.guild.me.user.displayAvatarURL() }) .setTimestamp() .setDescription(stripIndents` **Warned member:** ${member} (${member.id}) **Warned By:** ${member.guild.me} **Reason:** Spam`) logChannel.send({text: '', embeds: embed}); } });
This works just fix it like mine above https://github.com/Michael-J-Scofield/discord-anti-spam/issues/160#issuecomment-1049491176
That doesn't fix the issue why the warnMessage option already doesn't give the option to add the embeds.
Hello, i have read the code of the module and i have find this lines that make the crash when you using embeds messages (you need to a .content a the end of the this.format()
)
222 if (embed.description) embed.setDescription(embed.description)
223 if (embed.title) embed.setTitle(embed.title)
224 if (embed.footer && embed.footer.text) embed.footer.text = this.format(embed.footer.text, message)
225 if (embed.author && embed.author.name) embed.author.name = this.format(embed.author.name, message)
Hello, i have read the code of the module and i have find this lines that make the crash when you using embeds messages (you need to a .content a the end of the
this.format()
)
222 if (embed.description) embed.setDescription(embed.description)
223 if (embed.title) embed.setTitle(embed.title)
224 if (embed.footer && embed.footer.text) embed.footer.text = this.format(embed.footer.text, message)
225 if (embed.author && embed.author.name) embed.author.name = this.format(embed.author.name, message)
I already found out :). It's in my work in progress branch.
But thank you for letting know!
A option to add embeds was added in v2.8.0. Please see https://discord-anti-spam.js.org for more information!
const antiSpam = new AntiSpam({ warnThreshold: 3, muteThreshold: 4, maxInterval: 2000, warnMessage: "{@user}, Please stop spamming", muteMessage: [em], //That's the embed maxDuplicatesWarning: 6, maxDuplicatesMute: 8, ignoredPermissions: ["ADMINISTRATOR"], ignoreBots: true, verbose: true, ignoredMembers: [], unMuteTime: 10, removeMessages: true, modLogsEnabled: false, modLogsChannelName: "mod-logs", modLogsMode: "embed", });