Class: RubyCord::Guild::ForumChannel::Post
- Inherits:
-
ThreadChannel
- Object
- DiscordModel
- Channel
- Channel
- ThreadChannel
- RubyCord::Guild::ForumChannel::Post
- Defined in:
- lib/rubycord/guild/channel/forum.rb
Overview
Represents a thread in the forum channel.
Instance Attribute Summary collapse
-
#pinned ⇒ Boolean
(also: #pinned?)
readonly
Whether the post is pinned.
-
#tags ⇒ Array<RubyCord::Guild::ForumChannel::Tag>
readonly
The tags of the post.
Attributes inherited from ThreadChannel
#archived, #archived_timestamp, #auto_archive_duration, #id, #member_count, #members, #message_count, #name, #rate_limit_per_user
Attributes inherited from Channel
#permission_overwrites, #position
Attributes inherited from Channel
Instance Method Summary collapse
-
#add_tags(*tags, reason: nil) ⇒ Async::Task<self>
Adds tags to the thread.
-
#edit(name: RubyCord::Unset, archived: RubyCord::Unset, auto_archive_duration: RubyCord::Unset, archive_in: RubyCord::Unset, locked: RubyCord::Unset, pinned: RubyCord::Unset, tags: RubyCord::Unset, reason: nil) ⇒ Async::Task<self>
Edit the thread.
-
#pin(reason: nil) ⇒ Async::Task<self>
Pins the thread.
-
#remove_tags(*tags, reason: nil) ⇒ Async::Task<self>
Removes tags from the thread.
-
#unpin(reason: nil) ⇒ Async::Task<self>
Unpins the thread.
Methods inherited from ThreadChannel
#add_member, #archive, #fetch_members, #guild, #inspect, #joined?, #lock, #me, #owner, #parent, #remove_member, #unarchive, #unlock
Methods included from Internal::Messageable
#delete_message, #edit_message, #fetch_message, #fetch_messages, #fetch_pins, #pin_message, #post, #typing, #unpin_message
Methods inherited from Channel
#<=>, #==, #create_invite, #delete, #delete_permissions, #fetch_invites, #guild, #inspect, #mention, #move, #parent, #set_permissions, #to_s
Methods inherited from Channel
Methods inherited from DiscordModel
Instance Attribute Details
#pinned ⇒ Boolean (readonly) Also known as: pinned?
Returns Whether the post is pinned.
116 117 118 |
# File 'lib/rubycord/guild/channel/forum.rb', line 116 def pinned @pinned end |
#tags ⇒ Array<RubyCord::Guild::ForumChannel::Tag> (readonly)
Returns The tags of the post.
114 115 116 |
# File 'lib/rubycord/guild/channel/forum.rb', line 114 def end |
Instance Method Details
#add_tags(*tags, reason: nil) ⇒ Async::Task<self>
Adds tags to the thread.
218 219 220 |
# File 'lib/rubycord/guild/channel/forum.rb', line 218 def (*, reason: nil) edit(tags: self. + , reason:) end |
#edit(name: RubyCord::Unset, archived: RubyCord::Unset, auto_archive_duration: RubyCord::Unset, archive_in: RubyCord::Unset, locked: RubyCord::Unset, pinned: RubyCord::Unset, tags: RubyCord::Unset, reason: nil) ⇒ Async::Task<self>
The arguments of this method are defaultly set to RubyCord::Unset
.
Specify value to set the value, if not don't specify or specify RubyCord::Unset
.
Edit the thread.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/rubycord/guild/channel/forum.rb', line 144 def edit( name: RubyCord::Unset, archived: RubyCord::Unset, auto_archive_duration: RubyCord::Unset, archive_in: RubyCord::Unset, locked: RubyCord::Unset, pinned: RubyCord::Unset, tags: RubyCord::Unset, reason: nil ) Async do payload = {} payload[:name] = name if name != RubyCord::Unset payload[:archived] = archived if archived != RubyCord::Unset auto_archive_duration ||= archive_in payload[ :auto_archive_duration ] = auto_archive_duration if auto_archive_duration != RubyCord::Unset payload[:locked] = locked if locked != RubyCord::Unset payload[:flags] = pinned ? 1 : 0 if pinned != RubyCord::Unset payload[:applied_tags] = .map(&:id) if != RubyCord::Unset @client .http .request( RubyCord::Internal::Route.new("/channels/#{@id}", "//channels/:channel_id", :patch), payload, audit_log_reason: reason ) .wait self end end |
#pin(reason: nil) ⇒ Async::Task<self>
Pins the thread.
188 189 190 |
# File 'lib/rubycord/guild/channel/forum.rb', line 188 def pin(reason: nil) edit(pinned: true, reason:) end |
#remove_tags(*tags, reason: nil) ⇒ Async::Task<self>
Removes tags from the thread.
233 234 235 |
# File 'lib/rubycord/guild/channel/forum.rb', line 233 def (*, reason: nil) edit(tags: self. - , reason:) end |
#unpin(reason: nil) ⇒ Async::Task<self>
Unpins the thread.
203 204 205 |
# File 'lib/rubycord/guild/channel/forum.rb', line 203 def unpin(reason: nil) edit(pinned: false, reason:) end |