Automod command

This code should be creating a automod rule and selecting a log channel, it creates the rule but doens't select the log channel, i tried to log it and thats what i got Code - https://sourceb.in/lQniYe80Y8 logChannel log - https://sourceb.in/T1ebYc9oBR
No description
31 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
᲼
OP9mo ago
@Shook that wayy?
Rayan
Rayan9mo ago
yes, hopefully someone can help you soon
᲼
OP9mo ago
kk
ir
ir9mo ago
have you tried passing logChannel.id instead of just the logChannel?
᲼
OP9mo ago
you want me to log it or to pass the id in the command?
ir
ir9mo ago
pass the id here
actions: [{ type: 1, metadata: { channel: logChannel.id, durationSeconds: 10, customMessage: `This message was prevented by Atoms' AutoMod.` } }]
actions: [{ type: 1, metadata: { channel: logChannel.id, durationSeconds: 10, customMessage: `This message was prevented by Atoms' AutoMod.` } }]
^ change your current code to this
᲼
OP9mo ago
done, ill try now didnt work
ir
ir9mo ago
the documentation for action metadata says that you're supposed to pass channel_id into it, not channel. is { channel } autocompleted for you?
No description
᲼
OP9mo ago
Someone just told me to use channel xD
ir
ir9mo ago
hmmm try { channelId: logChannel.id }
᲼
OP9mo ago
K Didn’t work
ir
ir9mo ago
give me one second, im gonna try and do this via my bot and see what i can find out
᲼
OP9mo ago
Aight
duck
duck9mo ago
action type 1 seems to just be for BlockMessage you'd want a separate action of type SendAlertMessage to send an alert message to a channel you'd want to take note of the associated action types here https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-metadata you should also consider using the AutoModerationActionType enum so that your code is readable
᲼
OP9mo ago
How it would look like with this enum
duck
duck9mo ago
e.g. AutoModerationActionType.BlockMessage
᲼
OP9mo ago
I had to turn off my pc so it’s harder to work now
duck
duck9mo ago
and to come back to this, since they're using discord.js, this is something to look at the discord.js docs for over the dapi docs the property to use would be channel
᲼
OP9mo ago
I will need 2 action types right? actions: [{ type: 1, metadata: { channelId: logChannel.id, durationSeconds: 10, customMessage: This message was prevented by Atoms' AutoMod. } }] Just need to know how this line will look like with the 2 action types
duck
duck9mo ago
you would want a separate action not 2 types for the same action each action should be its own object in the array
᲼
OP9mo ago
How would this look like I’m confused God I hate this iPad keyboard
duck
duck9mo ago
[{}, {}] is an example of 2 objects in an array if you haven't properly learned basic syntax, you may want to brush up on javascript before continuing
᲼
OP9mo ago
Got it My brain wasn’t braining It worked Tysm @duck @d
rip_star
rip_star9mo ago
how did u join a guild
᲼
OP9mo ago
Magic
rip_star
rip_star9mo ago
tell pls ive waitlisted
duck
duck9mo ago
Please take the off topic chat elsewhere Though I imagine the way after being put on a wait list would be to wait
᲼
OP9mo ago
duck, can u help me again? i forgot i had this forum and created another for automod related thingey if ur free can I ping u ?
duck
duck9mo ago
This seems like a redundant question to ask immediately after pinging someone Please take note of #rules 5
᲼
OP9mo ago
reply pinged? i disabled it.. sorry "i forgot i had this one"

Did you find this page helpful?