Class: Discorb::AllowedMentions
- Inherits:
-
Object
- Object
- Discorb::AllowedMentions
- Defined in:
- lib/discorb/allowed_mentions.rb
Overview
Represents a allowed mentions in a message.
Instance Attribute Summary collapse
-
#everyone -> Boolean
Whether to allow @everyone or @here.
-
#replied_user -> Boolean
Whether to ping the user that sent the message to reply.
-
#roles -> Boolean, Array<Discorb::Role>
The roles to allow, or false to disable.
-
#users -> Boolean, Array<Discorb::User>
The users to allow, or false to disable.
Instance Method Summary collapse
-
#initialize(everyone: nil, roles: nil, users: nil, replied_user: nil) -> AllowedMentions
constructor
Initializes a new instance of the AllowedMentions class.
- #inspect -> Object
- #nil_merge(*args) -> Object
Constructor Details
#initialize(everyone: nil, roles: nil, users: nil, replied_user: nil) -> AllowedMentions
Initializes a new instance of the AllowedMentions class.
24 25 26 27 28 29 |
# File 'lib/discorb/allowed_mentions.rb', line 24 def initialize(everyone: nil, roles: nil, users: nil, replied_user: nil) @everyone = everyone @roles = roles @users = users @replied_user = replied_user end |
Instance Attribute Details
#everyone -> Boolean
Returns Whether to allow @everyone or @here.
8 9 10 |
# File 'lib/discorb/allowed_mentions.rb', line 8 def everyone @everyone end |
#replied_user -> Boolean
Returns Whether to ping the user that sent the message to reply.
14 15 16 |
# File 'lib/discorb/allowed_mentions.rb', line 14 def replied_user @replied_user end |
#roles -> Boolean, Array<Discorb::Role>
Returns The roles to allow, or false to disable.
10 11 12 |
# File 'lib/discorb/allowed_mentions.rb', line 10 def roles @roles end |
#users -> Boolean, Array<Discorb::User>
Returns The users to allow, or false to disable.
12 13 14 |
# File 'lib/discorb/allowed_mentions.rb', line 12 def users @users end |
Instance Method Details
#inspect -> Object
31 32 33 |
# File 'lib/discorb/allowed_mentions.rb', line 31 def inspect "#<#{self.class} @everyone=#{@everyone} @roles=#{@roles} @users=#{@users} @replied_user=#{@replied_user}>" end |
#nil_merge(*args) -> Object
64 65 66 67 68 69 |
# File 'lib/discorb/allowed_mentions.rb', line 64 def nil_merge(*args) args.each do |a| return a unless a.nil? end nil end |