Class: Discorb::Channel Abstract

Inherits:
DiscordModel show all
Defined in:
lib/discorb/channel/base.rb

Overview

This class is abstract.

Represents a channel of Discord.

Direct Known Subclasses

DMChannel, GuildChannel, ThreadChannel

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#eql?

Instance Attribute Details

#idDiscorb::Snowflake (readonly)

Returns The ID of the channel.

Returns:



10
11
12
# File 'lib/discorb/channel/base.rb', line 10

def id
  @id
end

#nameString (readonly)

Returns The name of the channel.

Returns:

  • (String)

    The name of the channel.



12
13
14
# File 'lib/discorb/channel/base.rb', line 12

def name
  @name
end

Instance Method Details

#==(other) ⇒ Boolean

Checks if the channel is other channel.

Parameters:

Returns:

  • (Boolean)

    True if the channel is other channel.



39
40
41
42
43
# File 'lib/discorb/channel/base.rb', line 39

def ==(other)
  return false unless other.respond_to?(:id)

  @id == other.id
end

#inspectObject



45
46
47
# File 'lib/discorb/channel/base.rb', line 45

def inspect
  "#<#{self.class} \"##{@name}\" id=#{@id}>"
end

#typeObject



85
86
87
# File 'lib/discorb/channel/base.rb', line 85

def type
  self.class.channel_type
end