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 toolkit12mo 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
axiprime12mo 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
axiprime12mo 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 DELTAOP12mo ago
What is the event for timeout and unmute I can't get that
axiprime
axiprime12mo 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 DELTAOP12mo 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
axiprime12mo ago
You can remove it with the <guildmember>.timeout(null,reason) Just listen to the events and look which one trigger.
NOT DELTA
NOT DELTAOP12mo ago
I already have timeout, unmute commands , but I don't know the logging functions
axiprime
axiprime12mo ago
When someone getting muted, in the auditlog you have an executor and a target
NOT DELTA
NOT DELTAOP12mo ago
So then
NOT DELTA
NOT DELTAOP12mo ago
I got this @Axiprime
No description
NOT DELTA
NOT DELTAOP12mo ago
Now I want to log this so what should I do
axiprime
axiprime12mo ago
Add a listener to this event log what happen when you mute someone You get all the info
NOT DELTA
NOT DELTAOP12mo ago
What kind of
axiprime
axiprime12mo ago
guildAuditLogEntryCreate is the event
NOT DELTA
NOT DELTAOP12mo ago
Then >
axiprime
axiprime12mo ago
bro.. You want to know when someone is muted,
NOT DELTA
NOT DELTAOP12mo ago
Bro I am new at this
axiprime
axiprime12mo ago
Just log and see what it return.
NOT DELTA
NOT DELTAOP12mo ago
Can you give me the code ?
axiprime
axiprime12mo ago
You dont have your own bot ?
NOT DELTA
NOT DELTAOP12mo ago
I have Lemme give you the mute.js file
axiprime
axiprime12mo ago
I'm not gonna open it ^^ put it on pastebin or something
NOT DELTA
NOT DELTAOP12mo ago
Copy paste using ``` Wait
axiprime
axiprime12mo 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
axiprime12mo ago
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
NOT DELTA
NOT DELTAOP12mo ago
Kk, no yt videos regarding this So that's why I am here
axiprime
axiprime12mo ago
Look at all the link i'm provinding you.
NOT DELTA
NOT DELTAOP12mo ago
Kk thanks
d.js docs
d.js docs12mo ago
guide Popular Topics: Working with Audit Logs read more
NOT DELTA
NOT DELTAOP12mo ago
@polarwolvinny ❄ 🌈 may I know the Aduit Logs event for timeout and unmute ?
treble/luna
treble/luna12mo ago
there is no even5 You have to filter it out
d.js docs
d.js docs12mo ago
dtypes v10: AuditLogEvent read more
NOT DELTA
NOT DELTAOP12mo ago
I try this and got every thing @Axiprime bro problem solved thats for suggesting me to do console log everything
treble/luna
treble/luna12mo 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 DELTAOP12mo 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/luna12mo ago
for that you can also just use
NOT DELTA
NOT DELTAOP12mo ago
what ?
d.js docs
d.js docs12mo ago
property GuildMember#communicationDisabledUntilTimestamp The timestamp this member's timeout will be removed
NOT DELTA
NOT DELTAOP12mo 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/luna12mo 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 DELTAOP12mo ago
k thanks
Want results from more Discord servers?
Add your server