Class: Discordrb::AuditLogs::Entry
- Inherits:
-
Object
- Object
- Discordrb::AuditLogs::Entry
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data/audit_logs.rb
Overview
An entry in a server's audit logs.
Instance Attribute Summary collapse
-
#action ⇒ Symbol
readonly
The action that was performed.
-
#action_type ⇒ Symbol
readonly
The type action that was performed.
-
#application_id ⇒ Integer?
readonly
The ID of the application whose application command permissions were updated.
-
#automod_rule_name ⇒ String?
readonly
The name of the auto moderation rule that was triggered.
-
#automod_rule_trigger_type ⇒ Integer?
readonly
The trigger type of the auto moderation rules that was triggered.
-
#changes ⇒ Hash<String => Change>, ...
readonly
The changes from this log, listing the key as the key changed.
-
#count ⇒ Integer?
(also: #amount)
readonly
The amount of messages deleted.
-
#days ⇒ Integer?
readonly
The amount of days the members were inactive for.
-
#integration_type ⇒ String?
readonly
The type of the integration that updated the member's roles, or kicked the member.
-
#members_removed ⇒ Integer?
readonly
The amount of members removed.
-
#message_id ⇒ Integer?
readonly
The ID of the message that was pinned or unpinned.
-
#overwrite_id ⇒ Integer?
readonly
The ID of the permission overwrite.
-
#overwrite_role_name ⇒ String?
readonly
The name of the role associated with the permission overwrite.
-
#overwrite_type ⇒ Symbol?
readonly
The type of the permission overwrite.
-
#reason ⇒ String?
readonly
The reason for this action occurring.
-
#target_type ⇒ Symbol
readonly
The type of target being performed on.
Attributes included from IDObject
Instance Method Summary collapse
-
#channel ⇒ Channel?
The channel associated with the audit log event.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
-
#message ⇒ Message?
The message that was pinned or un-pinned.
-
#target ⇒ Server, ...
The target being performed on.
-
#user ⇒ Member, User
(also: #author)
The user that authored this action.
Methods included from IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#action ⇒ Symbol (readonly)
Returns the action that was performed.
136 137 138 |
# File 'lib/discordrb/data/audit_logs.rb', line 136 def action @action end |
#action_type ⇒ Symbol (readonly)
Returns the type action that was performed. (:create, :delete, :update, :unknown).
139 140 141 |
# File 'lib/discordrb/data/audit_logs.rb', line 139 def action_type @action_type end |
#application_id ⇒ Integer? (readonly)
Returns the ID of the application whose application command permissions were updated.
161 162 163 |
# File 'lib/discordrb/data/audit_logs.rb', line 161 def application_id @application_id end |
#automod_rule_name ⇒ String? (readonly)
Returns the name of the auto moderation rule that was triggered.
164 165 166 |
# File 'lib/discordrb/data/audit_logs.rb', line 164 def automod_rule_name @automod_rule_name end |
#automod_rule_trigger_type ⇒ Integer? (readonly)
Returns the trigger type of the auto moderation rules that was triggered.
167 168 169 |
# File 'lib/discordrb/data/audit_logs.rb', line 167 def automod_rule_trigger_type @automod_rule_trigger_type end |
#changes ⇒ Hash<String => Change>, ... (readonly)
Returns the changes from this log, listing the key as the key changed. Will be a RoleChange object if the action is :member_role_update. Will be nil if the action is either :message_delete or :member_prune.
182 183 184 |
# File 'lib/discordrb/data/audit_logs.rb', line 182 def changes @changes end |
#count ⇒ Integer? (readonly) Also known as: amount
Returns the amount of messages deleted. Only present if the action is :message_delete.
145 146 147 |
# File 'lib/discordrb/data/audit_logs.rb', line 145 def count @count end |
#days ⇒ Integer? (readonly)
Returns the amount of days the members were inactive for. Only present if the action is :member_prune.
149 150 151 |
# File 'lib/discordrb/data/audit_logs.rb', line 149 def days @days end |
#integration_type ⇒ String? (readonly)
Returns the type of the integration that updated the member's roles, or kicked the member.
158 159 160 |
# File 'lib/discordrb/data/audit_logs.rb', line 158 def integration_type @integration_type end |
#members_removed ⇒ Integer? (readonly)
Returns the amount of members removed. Only present if the action is :member_prune.
152 153 154 |
# File 'lib/discordrb/data/audit_logs.rb', line 152 def members_removed @members_removed end |
#message_id ⇒ Integer? (readonly)
Returns the ID of the message that was pinned or unpinned.
155 156 157 |
# File 'lib/discordrb/data/audit_logs.rb', line 155 def @message_id end |
#overwrite_id ⇒ Integer? (readonly)
Returns the ID of the permission overwrite.
173 174 175 |
# File 'lib/discordrb/data/audit_logs.rb', line 173 def overwrite_id @overwrite_id end |
#overwrite_role_name ⇒ String? (readonly)
Returns the name of the role associated with the permission overwrite.
170 171 172 |
# File 'lib/discordrb/data/audit_logs.rb', line 170 def overwrite_role_name @overwrite_role_name end |
#overwrite_type ⇒ Symbol? (readonly)
Returns the type of the permission overwrite.
176 177 178 |
# File 'lib/discordrb/data/audit_logs.rb', line 176 def overwrite_type @overwrite_type end |
#reason ⇒ String? (readonly)
Returns the reason for this action occurring.
179 180 181 |
# File 'lib/discordrb/data/audit_logs.rb', line 179 def reason @reason end |
#target_type ⇒ Symbol (readonly)
Returns the type of target being performed on. (:server, :channel, :user, :role, :invite, :webhook, :emoji, :unknown).
142 143 144 |
# File 'lib/discordrb/data/audit_logs.rb', line 142 def target_type @target_type end |
Instance Method Details
#channel ⇒ Channel?
Returns the channel associated with the audit log event.
233 234 235 236 237 |
# File 'lib/discordrb/data/audit_logs.rb', line 233 def channel return nil unless @channel_id @channel ||= @bot.channel(@channel_id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
260 261 262 |
# File 'lib/discordrb/data/audit_logs.rb', line 260 def inspect "<AuditLogs::Entry id=#{@id} key=#{@key} action=#{@action} reason=#{@reason} action_type=#{@action_type} target_type=#{@target_type} count=#{@count} days=#{@days} members_removed=#{@members_removed}>" end |
#message ⇒ Message?
Returns the message that was pinned or un-pinned.
240 241 242 |
# File 'lib/discordrb/data/audit_logs.rb', line 240 def channel.(@message_id) if @message_id end |
#target ⇒ Server, ...
Returns the target being performed on.
221 222 223 |
# File 'lib/discordrb/data/audit_logs.rb', line 221 def target @target ||= process_target(@data['target_id'], @target_type) end |
#user ⇒ Member, User Also known as:
Returns the user that authored this action. Can be a User object if the user no longer exists in the server.
226 227 228 |
# File 'lib/discordrb/data/audit_logs.rb', line 226 def user @user ||= @server.member(@data['user_id'].to_i) || @bot.user(@data['user_id'].to_i) || @logs&.user(@data['user_id'].to_i) end |