Rem
Rem
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
thanks for the help 😊
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
i added this 3 months ago, pls no judging Pain
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
facepalmz
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
i dont think this was a good idea to do on ready:
const automod = await guild.autoModerationRules.fetch();

// for each automod, remove guild object
automod.forEach(async (rule) => {
rule.guild = null
})
const automod = await guild.autoModerationRules.fetch();

// for each automod, remove guild object
automod.forEach(async (rule) => {
rule.guild = null
})
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
but we kinda need it, is there no way around it?
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
we fetched guilds on ready
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
oh
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
ok, even without it it doesnt work tho
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
@Woffer12
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
Hi, even this isn't working
await client.guilds.fetch();
const guild = interaction.guild;
const automodRule = await guild.autoModerationRules.fetch("any guild id");
if (automodRule) {
console.log(`Automod rule found: ${automodRule}`);
} else {
console.log("No automod rule found");
}

const editttttt = {
name: "Block Custom Words",
eventType: 1,
triggerMetadata: {
allowList: ["yes"],
keywordFilter: ["hi"],
regexPatterns: ["no"],
presets: [],
mentionTotalLimit: null,
mentionRaidProtectionEnabled: false,
},
actions: [],
enabled: true,
exemptRoles: [],
exemptChannels: [],
reason: "Automod test",
};

await automodRule.edit(editttttt);
await client.guilds.fetch();
const guild = interaction.guild;
const automodRule = await guild.autoModerationRules.fetch("any guild id");
if (automodRule) {
console.log(`Automod rule found: ${automodRule}`);
} else {
console.log("No automod rule found");
}

const editttttt = {
name: "Block Custom Words",
eventType: 1,
triggerMetadata: {
allowList: ["yes"],
keywordFilter: ["hi"],
regexPatterns: ["no"],
presets: [],
mentionTotalLimit: null,
mentionRaidProtectionEnabled: false,
},
actions: [],
enabled: true,
exemptRoles: [],
exemptChannels: [],
reason: "Automod test",
};

await automodRule.edit(editttttt);
error:
TypeError: Cannot read properties of null (reading 'autoModerationRules')
at AutoModerationRule.edit (C:\Users\me\Documents\GitHub\bot\node_modules\discord.js\src\structures\AutoModerationRule.js:146:23)
at Object.execute (C:\Users\me\Documents\GitHub\bot\plugins\help\help.js:239:44)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

(yes, i tested in a /help command)
TypeError: Cannot read properties of null (reading 'autoModerationRules')
at AutoModerationRule.edit (C:\Users\me\Documents\GitHub\bot\node_modules\discord.js\src\structures\AutoModerationRule.js:146:23)
at Object.execute (C:\Users\me\Documents\GitHub\bot\plugins\help\help.js:239:44)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

(yes, i tested in a /help command)
40 replies
DIAdiscord.js - Imagine an app
Created by Woffer12 on 1/21/2024 in #djs-questions
Cannot read properties of null when editing a automod rule
ty
40 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
would have to look into that, but sounds like overcomplicating stuff
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
running a staging and "prod" which is essentially both staging 😄
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
but it depends a bit, i am exploring railway
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
not yet
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
yes
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
they're not my domains 😄
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
but i want to offer a white label feature for my application where people assign their own domain
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
well probably a few thousand
38 replies
RRailway
Created by Rem on 10/16/2023 in #✋|help
Custom Font Node app
then there's only 1 option left 😦
38 replies