Class: Discordrb::Role::Tags

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data/role.rb

Overview

Wrapper for the role tags

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Tags

Returns a new instance of Tags.



61
62
63
64
65
66
67
68
# File 'lib/discordrb/data/role.rb', line 61

def initialize(data)
  @bot_id = data['bot_id']&.resolve_id
  @integration_id = data['integration_id']&.resolve_id
  @premium_subscriber = data.key?('premium_subscriber')
  @subscription_listing_id = data['subscription_listing_id']&.resolve_id
  @available_for_purchase = data.key?('available_for_purchase')
  @guild_connections = data.key?('guild_connections')
end

Instance Attribute Details

#available_for_purchasetrue, false (readonly)

Returns Whether this role is available for purchase.

Returns:

  • (true, false)

    Whether this role is available for purchase



56
57
58
# File 'lib/discordrb/data/role.rb', line 56

def available_for_purchase
  @available_for_purchase
end

#bot_idInteger? (readonly)

Returns The ID of the bot this role belongs to.

Returns:

  • (Integer, nil)

    The ID of the bot this role belongs to



44
45
46
# File 'lib/discordrb/data/role.rb', line 44

def bot_id
  @bot_id
end

#guild_connectionstrue, false (readonly)

Returns Whether this role is a guild's linked role.

Returns:

  • (true, false)

    Whether this role is a guild's linked role



59
60
61
# File 'lib/discordrb/data/role.rb', line 59

def guild_connections
  @guild_connections
end

#integration_idInteger? (readonly)

Returns The ID of the integration this role belongs to.

Returns:

  • (Integer, nil)

    The ID of the integration this role belongs to



47
48
49
# File 'lib/discordrb/data/role.rb', line 47

def integration_id
  @integration_id
end

#premium_subscribertrue, false (readonly)

Returns Whether this is the guild's Booster role.

Returns:

  • (true, false)

    Whether this is the guild's Booster role



50
51
52
# File 'lib/discordrb/data/role.rb', line 50

def premium_subscriber
  @premium_subscriber
end

#subscription_listing_idInteger? (readonly)

Returns The id of this role's subscription sku and listing.

Returns:

  • (Integer, nil)

    The id of this role's subscription sku and listing



53
54
55
# File 'lib/discordrb/data/role.rb', line 53

def subscription_listing_id
  @subscription_listing_id
end