Class: Discordrb::AuditLogs
- Inherits:
-
Object
- Object
- Discordrb::AuditLogs
- Defined in:
- lib/discordrb/data/audit_logs.rb
Overview
A server’s audit logs
Defined Under Namespace
Classes: Change, Entry, RoleChange
Constant Summary collapse
- ACTIONS =
The numbers associated with the type of action.
{ 1 => :server_update, 10 => :channel_create, 11 => :channel_update, 12 => :channel_delete, 13 => :channel_overwrite_create, 14 => :channel_overwrite_update, 15 => :channel_overwrite_delete, 20 => :member_kick, 21 => :member_prune, 22 => :member_ban_add, 23 => :member_ban_remove, 24 => :member_update, 25 => :member_role_update, 26 => :member_move, 27 => :member_disconnect, 28 => :bot_add, 30 => :role_create, 31 => :role_update, 32 => :role_delete, 40 => :invite_create, 41 => :invite_update, 42 => :invite_delete, 50 => :webhook_create, 51 => :webhook_update, 52 => :webhook_delete, 60 => :emoji_create, 61 => :emoji_update, 62 => :emoji_delete, # 70 # 71 72 => :message_delete, 73 => :message_bulk_delete, 74 => :message_pin, 75 => :message_unpin, 80 => :integration_create, 81 => :integration_update, 82 => :integration_delete }.freeze
Instance Attribute Summary collapse
-
#entries ⇒ Array<Entry>
readonly
The entries listed in the audit logs.
-
#users ⇒ Hash<String => User>
readonly
The users included in the audit logs.
-
#webhooks ⇒ Hash<String => Webhook>
readonly
The webhooks included in the audit logs.
Instance Method Summary collapse
-
#latest ⇒ Entry
(also: #first)
The latest entry in the audit logs.
-
#user(id) ⇒ Object
Gets a user in the audit logs data based on user ID.
-
#webhook(id) ⇒ Object
Gets a webhook in the audit logs data based on webhook ID.
Instance Attribute Details
#entries ⇒ Array<Entry> (readonly)
Returns the entries listed in the audit logs.
74 75 76 |
# File 'lib/discordrb/data/audit_logs.rb', line 74 def entries @entries end |
Instance Method Details
#latest ⇒ Entry Also known as: first
Returns the latest entry in the audit logs.
276 277 278 |
# File 'lib/discordrb/data/audit_logs.rb', line 276 def latest @entries.first end |
#user(id) ⇒ Object
Note:
This only uses data given by the audit logs request
Gets a user in the audit logs data based on user ID
284 285 286 |
# File 'lib/discordrb/data/audit_logs.rb', line 284 def user(id) @users[id.resolve_id] end |
#webhook(id) ⇒ Object
Note:
This only uses data given by the audit logs request
Gets a webhook in the audit logs data based on webhook ID
291 292 293 |
# File 'lib/discordrb/data/audit_logs.rb', line 291 def webhook(id) @webhooks[id.resolve_id] end |