Class: DiscordRDA::MessageFlags
- Inherits:
-
Object
- Object
- DiscordRDA::MessageFlags
- Defined in:
- lib/discord_rda/entity/support.rb
Overview
Represents message flags
Constant Summary collapse
- FLAGS =
Flag bits
{ crossposted: 1 << 0, is_crosspost: 1 << 1, suppress_embeds: 1 << 2, source_message_deleted: 1 << 3, urgent: 1 << 4, has_thread: 1 << 5, ephemeral: 1 << 6, loading: 1 << 7, failed_to_mention_some_roles_in_thread: 1 << 8, suppress_notifications: 1 << 12, is_voice_message: 1 << 13 }.freeze
Instance Attribute Summary collapse
-
#value ⇒ Integer
readonly
Flag value.
Instance Method Summary collapse
-
#has?(flag) ⇒ Boolean
Check if a flag is set.
-
#initialize(value = 0) ⇒ MessageFlags
constructor
Initialize flags.
Constructor Details
#initialize(value = 0) ⇒ MessageFlags
Initialize flags
100 101 102 |
# File 'lib/discord_rda/entity/support.rb', line 100 def initialize(value = 0) @value = value.to_i end |
Instance Attribute Details
#value ⇒ Integer (readonly)
Returns Flag value.
96 97 98 |
# File 'lib/discord_rda/entity/support.rb', line 96 def value @value end |
Instance Method Details
#has?(flag) ⇒ Boolean
Check if a flag is set
107 108 109 110 111 112 |
# File 'lib/discord_rda/entity/support.rb', line 107 def has?(flag) bit = FLAGS[flag.to_sym] return false unless bit (@value & bit) == bit end |