ignavan39 / bitcoin-informer-telegram-bot Goto Github PK
View Code? Open in Web Editor NEWTelegram bot that sends the price of bitcoin to channels added by the administrator 🚀⌚
License: MIT License
Telegram bot that sends the price of bitcoin to channels added by the administrator 🚀⌚
License: MIT License
вся инфа
sendTitle - возрващает id сообщения
editTitle - редачит текущее сообщение
Связано с остальными issues
let newTitle = `${nowPercentage > 0 ? '🟢': '🔴'}${currency.toUpperCase()} ${currentCurrency}$ ` +
`${percentage > 0 ? `⬆️ (+${percentage}`: `⬇️(${percentage}`}%|24h)`
messageID = await sendPostController(marketData, vs_currency, channelId)
for(let i = previousMessageID; i < messageID && previousMessageID !== -1; i++){
await telegram.deleteMessage(channelId, i)
}
.sendMessage(
chatId,
`${info.name[0].toUpperCase() + info.name.slice(1)} Price $${info.price}
Market Cap $${info.allInfo.market_cap[vsCurrency]}
Trading Volume $${info.allInfo.total_volume[vsCurrency]}
Market Cap Rank #${info.allInfo.market_cap_rank}
——————————————
24h Low/ 24h High
$${info.allInfo.low_24h[vsCurrency]}/$${info.allInfo.high_24h[vsCurrency]}
`)
bot.hears(/(\w+) vs (\w+)/, ctx => {
if(ctx.message.from.id === adminId){
if(!ctx.update.message.forward_from_chat){
ctx.reply('Перешлите сообщение из нужного канала')
} else {
let channelId = ctx.update.message.forward_from_chat.id
mainLoop(ctx.match[1], ctx.match[2], channelId)
}
}
})
если да ->
let hasCurrency = await checkInAllCoins(currency)
if(!hasCurrency){
await telegram.sendMessage(channelId, 'Неверное название криптовалюты')
return;
}
let hasVsCurrency = await checkInVsCurrency(vs_currency)
if(!hasVsCurrency){
await telegram.sendMessage(channelId, 'Неверно введено название второй валюты')
return;
}
let marketData = await getCurrency(await getIdCurrency(currency), vs_currency)
if(!marketData){
await telegram.sendMessage(channelId, 'Не удалось сделать запрос к сервису')
return
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.