Class: Discorb::NewsChannel

Inherits:
TextChannel show all
Defined in:
lib/discorb/channel/text.rb

Overview

Represents a news channel (announcement channel).

Instance Attribute Summary

Attributes inherited from TextChannel

#default_auto_archive_duration, #last_message_id, #last_pin_timestamp, #nsfw, #rate_limit_per_user, #threads, #topic

Attributes inherited from GuildChannel

#permission_overwrites, #position

Attributes inherited from Channel

#id, #name

Instance Method Summary collapse

Methods inherited from TextChannel

#create_webhook, #delete_messages!, #edit, #fetch_archived_private_threads, #fetch_archived_public_threads, #fetch_joined_archived_private_threads, #fetch_webhooks, #follow_from, #start_thread

Methods included from Messageable

#delete_message!, #edit_message, #fetch_message, #fetch_messages, #fetch_pins, #pin_message, #post, #typing, #unpin_message

Methods inherited from GuildChannel

#<=>, #==, #create_invite, #delete!, #delete_permissions, #fetch_invites, #guild, #inspect, #mention, #move, #parent, #set_permissions, #to_s

Methods inherited from Channel

#==, #inspect, #type

Methods inherited from DiscordModel

#==, #eql?, #inspect

Instance Method Details

#follow_to(target, reason: nil) -> Async::Task<void>

Follow the existing announcement channel from self.

Parameters:

  • target (Discorb::TextChannel)

    The channel to follow to.

  • reason (String) (defaults to: nil)

    The reason of following the channel.

Returns:

  • (Async::Task<void>)

    The task.



329
330
331
332
333
334
# File 'lib/discorb/channel/text.rb', line 329

def follow_to(target, reason: nil)
  Async do
    @client.http.request(Route.new("/channels/#{@id}/followers", "//channels/:channel_id/followers", :post),
                         { webhook_channel_id: target.id }, audit_log_reason: reason).wait
  end
end