Class: Discordrb::RoleSubscriptionData
- Inherits:
-
Object
- Object
- Discordrb::RoleSubscriptionData
- Defined in:
- lib/discordrb/data/role_subscription.rb
Overview
Metadata about a purchase or renewal for a role subscription.
Instance Attribute Summary collapse
-
#listing_id ⇒ Integer
readonly
The ID of the SKU and listing the user is subscribed to.
-
#renewal ⇒ true, false
(also: #renewal?)
readonly
Whether the subscription notification is for a renewal.
-
#tier_name ⇒ String
readonly
The name of the tier the user is subscribed to.
-
#total_months_subscribed ⇒ Integer
readonly
The total number of months the user has been subscribed for.
Instance Method Summary collapse
-
#new? ⇒ true, false
Check if this role subscription is a new purchase.
-
#role ⇒ Role?
Get the role associated with the notification for this subscription.
Instance Attribute Details
#listing_id ⇒ Integer (readonly)
Returns the ID of the SKU and listing the user is subscribed to.
10 11 12 |
# File 'lib/discordrb/data/role_subscription.rb', line 10 def listing_id @listing_id end |
#renewal ⇒ true, false (readonly) Also known as: renewal?
Returns whether the subscription notification is for a renewal.
13 14 15 |
# File 'lib/discordrb/data/role_subscription.rb', line 13 def renewal @renewal end |
#tier_name ⇒ String (readonly)
Returns the name of the tier the user is subscribed to.
7 8 9 |
# File 'lib/discordrb/data/role_subscription.rb', line 7 def tier_name @tier_name end |
#total_months_subscribed ⇒ Integer (readonly)
Returns the total number of months the user has been subscribed for.
17 18 19 |
# File 'lib/discordrb/data/role_subscription.rb', line 17 def total_months_subscribed @total_months_subscribed end |
Instance Method Details
#new? ⇒ true, false
Check if this role subscription is a new purchase.
31 32 33 |
# File 'lib/discordrb/data/role_subscription.rb', line 31 def new? @renewal == false end |
#role ⇒ Role?
Get the role associated with the notification for this subscription.
37 38 39 |
# File 'lib/discordrb/data/role_subscription.rb', line 37 def role @message.server.roles.find { |role| role.&.subscription_listing_id == @listing_id } end |