Class: Discordrb::Events::ThreadMembersUpdateEvent
- Defined in:
- lib/discordrb/events/threads.rb
Overview
Raised when members are added or removed from a thread.
Instance Attribute Summary collapse
- #added_members ⇒ Array<Member, User> readonly
- #member_count ⇒ Integer readonly
- #removed_member_ids ⇒ Array<Integer> readonly
- #thread ⇒ Channel readonly
Attributes inherited from Event
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ ThreadMembersUpdateEvent
constructor
A new instance of ThreadMembersUpdateEvent.
Constructor Details
#initialize(data, bot) ⇒ ThreadMembersUpdateEvent
Returns a new instance of ThreadMembersUpdateEvent.
76 77 78 79 80 81 82 83 84 |
# File 'lib/discordrb/events/threads.rb', line 76 def initialize(data, bot) @bot = bot @thread = data.is_a?(Discordrb::Channel) ? data : bot.channel(data['id'].to_i) @added_members = data['added_members']&.map do |member| data['guild_id'] ? bot.member(data['guild_id'], member['user_id']) : bot.user(member['user_id']) end || [] @removed_member_ids = data['removed_member_ids']&.map(&:resolve_id) || [] @member_count = data['member_count'] end |
Instance Attribute Details
#added_members ⇒ Array<Member, User> (readonly)
66 67 68 |
# File 'lib/discordrb/events/threads.rb', line 66 def added_members @added_members end |
#member_count ⇒ Integer (readonly)
72 73 74 |
# File 'lib/discordrb/events/threads.rb', line 72 def member_count @member_count end |
#removed_member_ids ⇒ Array<Integer> (readonly)
69 70 71 |
# File 'lib/discordrb/events/threads.rb', line 69 def removed_member_ids @removed_member_ids end |
#thread ⇒ Channel (readonly)
63 64 65 |
# File 'lib/discordrb/events/threads.rb', line 63 def thread @thread end |