Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Bot API 8.1 #319

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions data/type_attributes.json
Original file line number Diff line number Diff line change
Expand Up @@ -4712,9 +4712,29 @@
"default": "failed"
}
},
"AffiliateInfo": {
"affiliate_user": {
"type": "User"
},
"affiliate_chat": {
"type": "Chat"
},
"commission_per_mille": {
"type": "integer",
"required": true
},
"amount": {
"type": "integer",
"required": true
},
"nanostar_amount": {
"type": "integer"
}
},
"TransactionPartner": {
"type": [
"TransactionPartnerUser",
"TransactionPartnerAffiliateProgram",
"TransactionPartnerFragment",
"TransactionPartnerTelegramAds",
"TransactionPartnerTelegramApi",
Expand All @@ -4732,6 +4752,9 @@
"type": "User",
"required": true
},
"affiliate": {
"type": "AffiliateInfo"
},
"invoice_payload": {
"type": "string"
},
Expand All @@ -4749,6 +4772,21 @@
"type": "Gift"
}
},
"TransactionPartnerAffiliateProgram": {
"type": {
"type": "string",
"required": true,
"required_value": "affiliate_program",
"default": "affiliate_program"
},
"sponsor_user": {
"type": "User"
},
"commission_per_mille": {
"type": "integer",
"required": true
}
},
"TransactionPartnerFragment": {
"type": {
"type": "string",
Expand Down Expand Up @@ -4797,6 +4835,9 @@
"type": "integer",
"required": true
},
"nanostar_amount": {
"type": "integer"
},
"date": {
"type": "integer",
"required": true
Expand Down
15 changes: 15 additions & 0 deletions lib/telegram/bot/types/affiliate_info.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Telegram
module Bot
module Types
class AffiliateInfo < Base
attribute? :affiliate_user, User
attribute? :affiliate_chat, Chat
attribute :commission_per_mille, Types::Integer
attribute :amount, Types::Integer
attribute? :nanostar_amount, Types::Integer
end
end
end
end
1 change: 1 addition & 0 deletions lib/telegram/bot/types/star_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Types
class StarTransaction < Base
attribute :id, Types::String
attribute :amount, Types::Integer
attribute? :nanostar_amount, Types::Integer
attribute :date, Types::Integer
attribute? :source, TransactionPartner
attribute? :receiver, TransactionPartner
Expand Down
1 change: 1 addition & 0 deletions lib/telegram/bot/types/transaction_partner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Types
# rubocop:disable Naming/ConstantName
TransactionPartner = (
TransactionPartnerUser |
TransactionPartnerAffiliateProgram |
TransactionPartnerFragment |
TransactionPartnerTelegramAds |
TransactionPartnerTelegramApi |
Expand Down
13 changes: 13 additions & 0 deletions lib/telegram/bot/types/transaction_partner_affiliate_program.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Telegram
module Bot
module Types
class TransactionPartnerAffiliateProgram < Base
attribute :type, Types::String.constrained(eql: 'affiliate_program').default('affiliate_program')
attribute? :sponsor_user, User
attribute :commission_per_mille, Types::Integer
end
end
end
end
1 change: 1 addition & 0 deletions lib/telegram/bot/types/transaction_partner_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Types
class TransactionPartnerUser < Base
attribute :type, Types::String.constrained(eql: 'user').default('user')
attribute :user, User
attribute? :affiliate, AffiliateInfo
attribute? :invoice_payload, Types::String
attribute? :subscription_period, Types::Integer
attribute? :paid_media, Types::Array.of(PaidMedia)
Expand Down
Loading