Class: Discorb::Channel Abstract

Inherits:
DiscordModel show all
Defined in:
lib/discorb/channel.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

#id -> Discorb::Snowflake (readonly)

Returns The ID of the channel.

Returns:



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

def id
  @id
end

#name -> String (readonly)

Returns The name of the channel.

Returns:

  • (String)

    The name of the channel.



14
15
16
# File 'lib/discorb/channel.rb', line 14

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.



37
38
39
40
41
# File 'lib/discorb/channel.rb', line 37

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

  @id == other.id
end

#inspect -> Object



43
44
45
# File 'lib/discorb/channel.rb', line 43

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

#type -> Object



66
67
68
# File 'lib/discorb/channel.rb', line 66

def type
  self.class.channel_type
end