Open SjogrenDev opened 4 weeks ago
@SjogrenDev would you mind providing the config you are passing to the backup.load function?
@SjogrenDev would you mind providing the config you are passing to the backup.load function?
I'm not passing any special settings.
The error you are receiving is because discord only allows one auto mod rule with type equal to 5, the backup then should only have one of those in the first place, the only instance where this error should occur is if clearing the guild is disabled. Thats why I asked for the options you used in case it was being disabled.
If you are not passing any options to the load function, is there any other relevant data you can provide to help determine the cause of this issue?
@SjogrenDev
Please send in the code you used and any other info that will help in resolving this issue since the error you gave is not fully helpful by itself.
Without more information about the backup being used and the options being passed to the load function, there is not much I can do to help resolve the problem. The error message appears to be a result of auto mod rules already existing on the server being restored. The automod rules should be getting cleared before hand but without more information to reproduce, there is nothing actionable.
If this continues being a problem and more information is provided, I am happy to work on a solution for it but in the meantime I am closing this issue.
My load config, let me know if you need other info.
const res = await Backup.load(foundBackup, interaction.guild, { maxMessagesPerChannel: messages, clearGuildBeforeRestore: true, speed: 250, }).catch((err) => err);
Automod rules of my dev server:
"autoModerationRules": [ { "name": "Block Mention Spam", "eventType": 1, "triggerType": 5, "triggerMetadata": { "keywordFilter": [], "regexPatterns": [], "presets": [], "allowList": [], "mentionTotalLimit": 20, "mentionRaidProtectionEnabled": true }, "actions": [ { "type": 1, "metadata": { "durationSeconds": null, "channelId": null, "customMessage": null } } ], "enabled": true, "exemptRoles": [], "exemptChannels": [] } ],
It's a default rule of community servers, that can't be deleted.
"Error occurred while deleting automod rules: Mention Spam AutoMod rule cannot be deleted from community servers"
This gives me the information I needed, Thank you. I will have a fix for this soon.
DiscordAPIError[50035]: Invalid Form Body 0[AUTO_MODERATION_MAX_RULES_OF_TYPE_EXCEEDED]: Maximum number of rules with trigger type 5 is 1 at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:727:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1128:23) at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:959:14) at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1272:22) at async AutoModerationRuleManager.create (/home/container/node_modules/discord.js/src/managers/AutoModerationRuleManager.js:122:18)