Class: Discordrb::ChannelTag
- Inherits:
-
Object
- Object
- Discordrb::ChannelTag
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data/channel_tag.rb
Overview
A forum or media tag that can be applied to threads.
Instance Attribute Summary collapse
-
#channel ⇒ Channel
readonly
The channel associated with the channel tag.
-
#moderated ⇒ true, false
(also: #moderated?)
readonly
Whether or not the channel tag is moderated.
-
#name ⇒ String
readonly
The 1-20 character name of the channel tag.
Attributes included from IDObject
Instance Method Summary collapse
-
#delete(reason: nil) ⇒ nil
Permenantly delete the channel tag.
-
#emoji ⇒ Emoji?
Get the emoji of the channel tag.
-
#modify(name: :undef, emoji: :undef, moderated: :undef, reason: nil) ⇒ nil
Modify the properties of the channel tag.
Methods included from IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#channel ⇒ Channel (readonly)
Returns the channel associated with the channel tag.
12 13 14 |
# File 'lib/discordrb/data/channel_tag.rb', line 12 def channel @channel end |
#moderated ⇒ true, false (readonly) Also known as: moderated?
Returns whether or not the channel tag is moderated.
15 16 17 |
# File 'lib/discordrb/data/channel_tag.rb', line 15 def moderated @moderated end |
#name ⇒ String (readonly)
Returns the 1-20 character name of the channel tag.
9 10 11 |
# File 'lib/discordrb/data/channel_tag.rb', line 9 def name @name end |
Instance Method Details
#delete(reason: nil) ⇒ nil
Permenantly delete the channel tag.
54 55 56 |
# File 'lib/discordrb/data/channel_tag.rb', line 54 def delete(reason: nil) @channel.({ id: @id, d: true }, reason) end |
#emoji ⇒ Emoji?
Get the emoji of the channel tag.
31 32 33 |
# File 'lib/discordrb/data/channel_tag.rb', line 31 def emoji @emoji_id ? @channel.server.emojis[@emoji_id] : @emoji_name end |
#modify(name: :undef, emoji: :undef, moderated: :undef, reason: nil) ⇒ nil
Modify the properties of the channel tag.
41 42 43 44 45 46 47 48 49 |
# File 'lib/discordrb/data/channel_tag.rb', line 41 def modify(name: :undef, emoji: :undef, moderated: :undef, reason: nil) data = { name: name, moderated: moderated, **(Emoji.build_emoji_hash(emoji) if emoji != :undef) }.reject { |_, value| value == :undef } @channel.(to_h.merge(data), reason) end |