Skip to content

Auditlog handler #1406

Answered by Earlopain
GAsNA asked this question in Q&A

You must be logged in to vote

This has been implemented but unfortunatly hasn't been released in a stable version yet 6958472. You will need to the master version (go get -u github.com/bwmarrin/discordgo@master) to get access to that right now. I'm doing that myself and have had no issues so don't be discouraged by that.

Here's some untested example code which should get the point across, your bot will also require the VIEW_AUDIT_LOG permission to recieve them:

func onAuditLogEntryCreate(s *discordgo.Session, action *discordgo.GuildAuditLogEntryCreate) {
    if *action.ActionType == discordgo.AuditLogActionMemberBanAdd{
        log.Printf("User <@%s> banned <@%s> with reason '%s'", action.UserID, action.TargetID, action.

Replies: 2 comments

You must be logged in to vote
0 replies
Answer selected by GAsNA

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants