Class: OnyxCord::Events::ChannelCreateEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/onyxcord/events/channels/base.rb

Overview

Raised when a channel is created

Direct Known Subclasses

ChannelUpdateEvent

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

Instance Attribute Details

#channelChannel (readonly)

Returns the channel in question.

Returns:

  • (Channel)

    the channel in question.



10
11
12
# File 'lib/onyxcord/events/channels/base.rb', line 10

def channel
  @channel
end

#idInteger (readonly)

Returns the channel's unique ID.

Returns:

  • (Integer)

    the channel's unique ID.

See Also:

  • Channel#id


30
# File 'lib/onyxcord/events/channels/base.rb', line 30

delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel

#nameString (readonly)

Returns the channel's name.

Returns:

  • (String)

    the channel's name

See Also:



30
# File 'lib/onyxcord/events/channels/base.rb', line 30

delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel

#positionInteger (readonly)

Returns the position of the channel in the channels list.

Returns:

  • (Integer)

    the position of the channel in the channels list.

See Also:



30
# File 'lib/onyxcord/events/channels/base.rb', line 30

delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel

#serverServer (readonly)

Returns the server the channel belongs to.

Returns:

  • (Server)

    the server the channel belongs to.

See Also:



30
# File 'lib/onyxcord/events/channels/base.rb', line 30

delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel

#topicString (readonly)

Returns the channel's topic.

Returns:

  • (String)

    the channel's topic.

See Also:



30
# File 'lib/onyxcord/events/channels/base.rb', line 30

delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel

#typeInteger (readonly)

Returns the channel's type (0: text, 1: private, 2: voice, 3: group).

Returns:

  • (Integer)

    the channel's type (0: text, 1: private, 2: voice, 3: group).

See Also:



30
# File 'lib/onyxcord/events/channels/base.rb', line 30

delegate :name, :server, :type, :owner_id, :recipients, :topic, :user_limit, :position, :permission_overwrites, to: :channel

Instance Method Details

#cached_channel(bot, channel_id) ⇒ Object



42
43
44
45
# File 'lib/onyxcord/events/channels/base.rb', line 42

def cached_channel(bot, channel_id)
  channels = bot.instance_variable_get(:@channels)
  channels&.[](channel_id.to_i)
end

#cached_server(bot, server_id) ⇒ Object



47
48
49
50
51
52
# File 'lib/onyxcord/events/channels/base.rb', line 47

def cached_server(bot, server_id)
  return nil unless server_id

  servers = bot.instance_variable_get(:@servers)
  servers&.[](server_id.to_i)
end