问题
Would it be possible to find the creator of a channel when the channelCreate event triggers? I've tried looking at the documentation of channels & channelCreate and to log the channel object to my console but there doesn't seem to be a parameter that clearly states "This ID created the channel". I know it has to be somewhere since Discord uses it in the audit logs.
回答1:
You can try listening to the channelCreate
event and then fetch the GuildAuditLogs with Guild.fetchAuditLogs(). Then you can look for the most recent AuditLogEntry who's AuditLogAction is CHANNEL_CREATE
. From that you can get the .executor to see who triggered the event
回答2:
If you try to get the channelCreator of an command, ex:
!channelcreate
you just need to get the author of the message.
else idk
来源:https://stackoverflow.com/questions/64502363/how-to-get-the-creator-of-a-channel-on-event-channelcreate-in-discord-js