22 lines
697 B
Python
22 lines
697 B
Python
from bot.DaMsg import DaMsg
|
||
from pycoingecko import CoinGeckoAPI
|
||
|
||
from bot import config
|
||
|
||
|
||
class CryptocurrencyMsg(DaMsg):
|
||
|
||
@staticmethod
|
||
def get_msg(data=None) -> str:
|
||
if data is None:
|
||
data = {}
|
||
cg = CoinGeckoAPI()
|
||
codes = config['CRYPTO_CHARCODES'].split(" ")
|
||
res = cg.get_price(ids=codes, vs_currencies=['usd'])
|
||
msg = '📈 Курс криптовалют на сегодня:\n\n'
|
||
for currency in codes:
|
||
msg = msg + "<b>" + currency + "</b>: " + str(res[currency]['usd']) + "$\n\n"
|
||
|
||
msg = msg + "👉 <a href='https://t.me/prosmi_bot'>Предложить новость</a>"
|
||
|
||
return msg |