Sha256: 13f617dd3505dab84f0b6a3333c37d1383a6c366cb583619da8724ff53a4e6cd
Contents?: true
Size: 799 Bytes
Versions: 1
Compression:
Stored size: 799 Bytes
Contents
class EventDecorator def initialize(event) @event = event end def channel @event.channel end def channel_id @event.channel.id end def display_name user.display_name end def user_id user.id end def users server.users end def mentions_for(user_ids) find_users(user_ids).map do |user| user&.mention end end def display_names_for(user_ids) find_users(user_ids).map(&:display_name) end def display_name_for(user_id) find_user(user_id).display_name end private def find_users(user_ids) user_ids.map do |user_id| find_user(user_id) end end def find_user(user_id) users.find { |user| user.id == user_id } end def server @event.server end def user @event.user end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
qwtf_discord_bot-5.1.9 | lib/event_decorator.rb |