I'm currently trying to create some sort of an announcement command for events or similar stuff. My issue currently is that it either sends the message X times to one server (X = the amount of servers the bot is in) or it just sends it to a random channel instead of the one that I wanted to send it in (I still don't know why that is).
module.exports.run = async (bot, message, args) => {
async function announcement(guild, user) {
const threshold = 0.85;
const channel = message.guild.channels.cache.find((channel) => {
const result = stringSimilarity.compareTwoStrings(
channel.name.toLowerCase(),
config.events
);
if (result >= threshold) {
return true;
}
return false;
});
bot.guilds.cache.forEach((guild) => {
console.log(guild.name);
//This is where I would send the message
//channel.send('message here')
});
}
async function myFunc() {
for (let guild of bot.guilds.cache) {
const response = true;
if (response) {
announcement();
}
}
resolve();
}
};
myFunc();
Also yes I know, my promise is rather useless currently, still gotta do some stuff with that.