Only make it update channel rate limits if they arent already set
This commit is contained in:
parent
18791ad9de
commit
9f8b65ff47
8
index.js
8
index.js
|
@ -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);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue