How to make modlogging when user got timeout and unmute(remove timeout) using audit log events

I want to make a modlogging system when user got timeout and unmute and the bot have to send log in a specific channel using audit log events
42 Replies
d.js toolkit
d.js toolkit13mo 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
axiprime
axiprime13mo ago
Log the event : guildAuditLogEntryCreate
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
axiprime
axiprime13mo ago
You can also use the voiceStateUpdate
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
NOT DELTA
NOT DELTAOP13mo ago
What is the event for timeout and unmute I can't get that
axiprime
axiprime13mo ago
I believe for timeout you can get it in the guildMemberUpdate But i'm sure you getting it in the log
NOT DELTA
NOT DELTAOP13mo ago
I already tried the guildMemberUpdate event , I want to log the particular timeout and remove timeout event , so is there any particular data entry for it
axiprime
axiprime13mo ago
You can remove it with the <guildmember>.timeout(null,reason) Just listen to the events and look which one trigger.
NOT DELTA
NOT DELTAOP13mo ago
I already have timeout, unmute commands , but I don't know the logging functions
axiprime
axiprime13mo ago
When someone getting muted, in the auditlog you have an executor and a target
NOT DELTA
NOT DELTAOP13mo ago
So then
NOT DELTA
NOT DELTAOP13mo ago
I got this @Axiprime
No description
NOT DELTA
NOT DELTAOP13mo ago
Now I want to log this so what should I do
axiprime
axiprime13mo ago
Add a listener to this event log what happen when you mute someone You get all the info
NOT DELTA
NOT DELTAOP13mo ago
What kind of
axiprime
axiprime13mo ago
guildAuditLogEntryCreate is the event
NOT DELTA
NOT DELTAOP13mo ago
Then >
axiprime
axiprime13mo ago
bro.. You want to know when someone is muted,
NOT DELTA
NOT DELTAOP13mo ago
Bro I am new at this
axiprime
axiprime13mo ago
Just log and see what it return.
NOT DELTA
NOT DELTAOP13mo ago
Can you give me the code ?
axiprime
axiprime13mo ago
You dont have your own bot ?
NOT DELTA
NOT DELTAOP13mo ago
I have Lemme give you the mute.js file
axiprime
axiprime13mo ago
I'm not gonna open it ^^ put it on pastebin or something
NOT DELTA
NOT DELTAOP13mo ago
Copy paste using ``` Wait
axiprime
axiprime13mo ago
I also not gonna build the hole thing for you. Look at the guide : https://discordjs.guide/#before-you-begin if you like to set-up some basic event listener
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
axiprime
axiprime13mo ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
NOT DELTA
NOT DELTAOP13mo ago
Kk, no yt videos regarding this So that's why I am here
axiprime
axiprime13mo ago
Look at all the link i'm provinding you.
NOT DELTA
NOT DELTAOP13mo ago
Kk thanks
d.js docs
d.js docs13mo ago
guide Popular Topics: Working with Audit Logs read more
NOT DELTA
NOT DELTAOP13mo ago
@polarwolvinny ❄ 🌈 may I know the Aduit Logs event for timeout and unmute ?
treble/luna
treble/luna13mo ago
there is no even5 You have to filter it out
d.js docs
d.js docs13mo ago
dtypes v10: AuditLogEvent read more
NOT DELTA
NOT DELTAOP13mo ago
I try this and got every thing @Axiprime bro problem solved thats for suggesting me to do console log everything
treble/luna
treble/luna13mo ago
first of all, use the above guides to create an event handler and second, make sure you have the intent which is GuildModeration
NOT DELTA
NOT DELTAOP13mo ago
i did all the things and its working fine how to get the timeout duration with "const { action, executorId, targetId, reason } = auditLog;" ?
treble/luna
treble/luna13mo ago
for that you can also just use
NOT DELTA
NOT DELTAOP13mo ago
what ?
d.js docs
d.js docs13mo ago
property GuildMember#communicationDisabledUntilTimestamp The timestamp this member's timeout will be removed
NOT DELTA
NOT DELTAOP13mo ago
what is the name for that to be added in { action, executorId, targetId, reason } ? @polarwolvinny ❄ 🌈 please tell me how to implement that ?
treble/luna
treble/luna13mo ago
can you not ping me for every reply. And if you just want the timeout, you're better off listening fornthe guildMemberUpdate event and checking there. If you do want to use audit logs, log it and see what it returns
NOT DELTA
NOT DELTAOP13mo ago
k thanks
Want results from more Discord servers?
Add your server