Class: Rubycord::Events::InviteCreateEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/rubycord/events/invites.rb

Overview

Raised when an invite is created.

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

Constructor Details

#initialize(data, invite, bot) ⇒ InviteCreateEvent

Returns a new instance of InviteCreateEvent.



35
36
37
38
39
40
# File 'lib/rubycord/events/invites.rb', line 35

def initialize(data, invite, bot)
  @bot = bot
  @invite = invite
  @channel = bot.channel(data["channel_id"])
  @server = bot.server(data["guild_id"]) if data["guild_id"]
end

Instance Attribute Details

#channel ⇒ Channel (readonly)

Returns The channel the invite was created for.

Returns:

  • (Channel) —

    The channel the invite was created for.



11
12
13
# File 'lib/rubycord/events/invites.rb', line 11

def channel
  @channel
end

#code ⇒ String (readonly)

Returns The code for the created invite.

Returns:

  • (String) —

    The code for the created invite.

See Also:



31
# File 'lib/rubycord/events/invites.rb', line 31

delegate :code, :created_at, :max_age, :max_uses, :temporary, :inviter, to: :invite

#created_at ⇒ Time (readonly)

Returns The time the invite was created at.

Returns:

  • (Time) —

    The time the invite was created at.

See Also:



31
# File 'lib/rubycord/events/invites.rb', line 31

delegate :code, :created_at, :max_age, :max_uses, :temporary, :inviter, to: :invite

#invite ⇒ Invite (readonly)

Returns The invite that was created.

Returns:

  • (Invite) —

    The invite that was created.



5
6
7
# File 'lib/rubycord/events/invites.rb', line 5

def invite
  @invite
end

#inviter ⇒ User (readonly)

Returns The user that created the invite.

Returns:

  • (User) —

    The user that created the invite.

See Also:



31
# File 'lib/rubycord/events/invites.rb', line 31

delegate :code, :created_at, :max_age, :max_uses, :temporary, :inviter, to: :invite

#max_age ⇒ Integer (readonly)

Returns The maximum age of the created invite.

Returns:

  • (Integer) —

    The maximum age of the created invite.

See Also:



31
# File 'lib/rubycord/events/invites.rb', line 31

delegate :code, :created_at, :max_age, :max_uses, :temporary, :inviter, to: :invite

#max_uses ⇒ Integer (readonly)

Returns The maximum number of uses before the invite expires.

Returns:

  • (Integer) —

    The maximum number of uses before the invite expires.

See Also:



31
# File 'lib/rubycord/events/invites.rb', line 31

delegate :code, :created_at, :max_age, :max_uses, :temporary, :inviter, to: :invite

#server ⇒ Server? (readonly)

Returns The server the invite was created for.

Returns:

  • (Server, nil) —

    The server the invite was created for.



8
9
10
# File 'lib/rubycord/events/invites.rb', line 8

def server
  @server
end

#temporary ⇒ true, false (readonly) Also known as: temporary?

Returns Whether or not this invite grants temporary membership.

Returns:

  • (true, false) —

    Whether or not this invite grants temporary membership.

See Also:



31
# File 'lib/rubycord/events/invites.rb', line 31

delegate :code, :created_at, :max_age, :max_uses, :temporary, :inviter, to: :invite