Only make it update channel rate limits if they arent already set

This commit is contained in:
Christopher Cookman 2024-04-21 10:05:35 -06:00
parent 18791ad9de
commit 9f8b65ff47
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -128,26 +128,26 @@ function updateSlowmodes() {
slowmode_categories.forEach(async (category) => { slowmode_categories.forEach(async (category) => {
category.category.guild.channels.cache.forEach((chan) => { category.category.guild.channels.cache.forEach((chan) => {
if (chan.parentId == category.category.id) { if (chan.parentId == category.category.id) {
chan.setRateLimitPerUser(category.defaultTime); if (chan.rateLimitPerUser != category.defaultTime) chan.setRateLimitPerUser(category.defaultTime);
} }
}) })
}); });
slowmode_channels.forEach(async (channel) => { slowmode_channels.forEach(async (channel) => {
return channel.channel.setRateLimitPerUser(channel.defaultTime); if (channel.channel.rateLimitPerUser != channel.defaultTime) return channel.channel.setRateLimitPerUser(channel.defaultTime);
}) })
} else { } else {
// Enable slowmodes // Enable slowmodes
slowmode_categories.forEach(async (category) => { slowmode_categories.forEach(async (category) => {
category.category.guild.channels.cache.forEach((chan) => { category.category.guild.channels.cache.forEach((chan) => {
if (chan.parentId == category.category.id) { if (chan.parentId == category.category.id) {
chan.setRateLimitPerUser(category.time); if (chan.rateLimitPerUser != category.time) chan.setRateLimitPerUser(category.time);
} }
}) })
}); });
slowmode_channels.forEach(async (channel) => { slowmode_channels.forEach(async (channel) => {
return channel.channel.setRateLimitPerUser(channel.time); if (channel.channel.rateLimitPerUser != channel.time) return channel.channel.setRateLimitPerUser(channel.time);
}) })
} }
} }