Add currency enum (#1194)

* Add currency enum

* Add change log

* Add butcher file

* Apply enum
This commit is contained in:
Yarik 2023-08-02 21:44:49 +03:00 committed by GitHub
parent a7916c1103
commit d3bec413db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 213 additions and 0 deletions

View file

@ -0,0 +1,93 @@
name: Currency
description: |
Currencies supported by Telegram Bot API
Source: https://core.telegram.org/bots/payments#supported-currencies
static:
AED: "AED" # United Arab Emirates Dirham
AFN: "AFN" # Afghan Afghani
ALL: "ALL" # Albanian Lek
AMD: "AMD" # Armenian Dram
ARS: "ARS" # Argentine Peso
AUD: "AUD" # Australian Dollar
AZN: "AZN" # Azerbaijani Manat
BAM: "BAM" # Bosnia & Herzegovina Convertible Mark
BDT: "BDT" # Bangladeshi Taka
BGN: "BGN" # Bulgarian Lev
BND: "BND" # Brunei Dollar
BOB: "BOB" # Bolivian Boliviano
BRL: "BRL" # Brazilian Real
BYN: "BYN" # Belarusian ruble
CAD: "CAD" # Canadian Dollar
CHF: "CHF" # Swiss Franc
CLP: "CLP" # Chilean Peso
CNY: "CNY" # Chinese Renminbi Yuan
COP: "COP" # Colombian Peso
CRC: "CRC" # Costa Rican Colón
CZK: "CZK" # Czech Koruna
DKK: "DKK" # Danish Krone
DOP: "DOP" # Dominican Peso
DZD: "DZD" # Algerian Dinar
EGP: "EGP" # Egyptian Pound
ETB: "ETB" # Ethiopian Birr
EUR: "EUR" # Euro
GBP: "GBP" # British Pound
GEL: "GEL" # Georgian Lari
GTQ: "GTQ" # Guatemalan Quetzal
HKD: "HKD" # Hong Kong Dollar
HNL: "HNL" # Honduran Lempira
HRK: "HRK" # Croatian Kuna
HUF: "HUF" # Hungarian Forint
IDR: "IDR" # Indonesian Rupiah
ILS: "ILS" # Israeli New Sheqel
INR: "INR" # Indian Rupee
ISK: "ISK" # Icelandic Króna
JMD: "JMD" # Jamaican Dollar
JPY: "JPY" # Japanese Yen
KES: "KES" # Kenyan Shilling
KGS: "KGS" # Kyrgyzstani Som
KRW: "KRW" # South Korean Won
KZT: "KZT" # Kazakhstani Tenge
LBP: "LBP" # Lebanese Pound
LKR: "LKR" # Sri Lankan Rupee
MAD: "MAD" # Moroccan Dirham
MDL: "MDL" # Moldovan Leu
MNT: "MNT" # Mongolian Tögrög
MUR: "MUR" # Mauritian Rupee
MVR: "MVR" # Maldivian Rufiyaa
MXN: "MXN" # Mexican Peso
MYR: "MYR" # Malaysian Ringgit
MZN: "MZN" # Mozambican Metical
NGN: "NGN" # Nigerian Naira
NIO: "NIO" # Nicaraguan Córdoba
NOK: "NOK" # Norwegian Krone
NPR: "NPR" # Nepalese Rupee
NZD: "NZD" # New Zealand Dollar
PAB: "PAB" # Panamanian Balboa
PEN: "PEN" # Peruvian Nuevo Sol
PHP: "PHP" # Philippine Peso
PKR: "PKR" # Pakistani Rupee
PLN: "PLN" # Polish Złoty
PYG: "PYG" # Paraguayan Guaraní
QAR: "QAR" # Qatari Riyal
RON: "RON" # Romanian Leu
RSD: "RSD" # Serbian Dinar
RUB: "RUB" # Russian Ruble
SAR: "SAR" # Saudi Riyal
SEK: "SEK" # Swedish Krona
SGD: "SGD" # Singapore Dollar
THB: "THB" # Thai Baht
TJS: "TJS" # Tajikistani Somoni
TRY: "TRY" # Turkish Lira
TTD: "TTD" # Trinidad and Tobago Dollar
TWD: "TWD" # New Taiwan Dollar
TZS: "TZS" # Tanzanian Shilling
UAH: "UAH" # Ukrainian Hryvnia
UGX: "UGX" # Ugandan Shilling
USD: "USD" # United States Dollar
UYU: "UYU" # Uruguayan Peso
UZS: "UZS" # Uzbekistani Som
VND: "VND" # Vietnamese Đồng
YER: "YER" # Yemeni Rial
ZAR: "ZAR" # South African Rand

12
CHANGES/1194.feature.rst Normal file
View file

@ -0,0 +1,12 @@
Added Currency enum.
You can use it like this:
.. code-block:: python
from aiogram import Bot
from aiogram.enum import Currency
await Bot.send_invoice(
...,
currency=Currency.USD,
...
)

View file

@ -3,6 +3,7 @@ from .chat_action import ChatAction
from .chat_member_status import ChatMemberStatus
from .chat_type import ChatType
from .content_type import ContentType
from .currency import Currency
from .dice_emoji import DiceEmoji
from .encrypted_passport_element import EncryptedPassportElement
from .inline_query_result_type import InlineQueryResultType
@ -24,6 +25,7 @@ __all__ = (
"ChatMemberStatus",
"ChatType",
"ContentType",
"Currency",
"DiceEmoji",
"EncryptedPassportElement",
"InlineQueryResultType",

96
aiogram/enums/currency.py Normal file
View file

@ -0,0 +1,96 @@
from enum import Enum
class Currency(str, Enum):
"""
Currencies supported by Telegram Bot API
Source: https://core.telegram.org/bots/payments#supported-currencies
"""
AED = "AED"
AFN = "AFN"
ALL = "ALL"
AMD = "AMD"
ARS = "ARS"
AUD = "AUD"
AZN = "AZN"
BAM = "BAM"
BDT = "BDT"
BGN = "BGN"
BND = "BND"
BOB = "BOB"
BRL = "BRL"
BYN = "BYN"
CAD = "CAD"
CHF = "CHF"
CLP = "CLP"
CNY = "CNY"
COP = "COP"
CRC = "CRC"
CZK = "CZK"
DKK = "DKK"
DOP = "DOP"
DZD = "DZD"
EGP = "EGP"
ETB = "ETB"
EUR = "EUR"
GBP = "GBP"
GEL = "GEL"
GTQ = "GTQ"
HKD = "HKD"
HNL = "HNL"
HRK = "HRK"
HUF = "HUF"
IDR = "IDR"
ILS = "ILS"
INR = "INR"
ISK = "ISK"
JMD = "JMD"
JPY = "JPY"
KES = "KES"
KGS = "KGS"
KRW = "KRW"
KZT = "KZT"
LBP = "LBP"
LKR = "LKR"
MAD = "MAD"
MDL = "MDL"
MNT = "MNT"
MUR = "MUR"
MVR = "MVR"
MXN = "MXN"
MYR = "MYR"
MZN = "MZN"
NGN = "NGN"
NIO = "NIO"
NOK = "NOK"
NPR = "NPR"
NZD = "NZD"
PAB = "PAB"
PEN = "PEN"
PHP = "PHP"
PKR = "PKR"
PLN = "PLN"
PYG = "PYG"
QAR = "QAR"
RON = "RON"
RSD = "RSD"
RUB = "RUB"
SAR = "SAR"
SEK = "SEK"
SGD = "SGD"
THB = "THB"
TJS = "TJS"
TRY = "TRY"
TTD = "TTD"
TWD = "TWD"
TZS = "TZS"
UAH = "UAH"
UGX = "UGX"
USD = "USD"
UYU = "UYU"
UZS = "UZS"
VND = "VND"
YER = "YER"
ZAR = "ZAR"

View file

@ -0,0 +1,9 @@
########
Currency
########
.. automodule:: aiogram.enums.currency
:members:
:member-order: bysource
:undoc-members: True

View file

@ -15,6 +15,7 @@ Here is list of all available enums:
chat_member_status
chat_type
content_type
currency
dice_emoji
encrypted_passport_element
inline_query_result_type