Skip to content

Commit

Permalink
wip: telegram bot
Browse files Browse the repository at this point in the history
  • Loading branch information
topether21 committed Dec 8, 2023
1 parent f6b8fff commit ad5615c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions setup-telegram-bot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const TelegramBot = require('node-telegram-bot-api')
const { get_user_limits } = require('./deezy')
if (!process.env.TELEGRAM_BOT_TOKEN) {
throw new Error('You must set TELEGRAM_BOT_TOKEN in the .env file')
}
Expand All @@ -12,3 +13,29 @@ bot.on('message', (msg) => {
console.log(`TELEGRAM_CHAT_ID=${chatId}`)
bot.sendMessage(chatId, `Welcome to Deezy\'s Sat Hunter Bot. Hope you're ready to hunt down some rare sats :)`)
})

// Listen for /limits command
// WIP: not working yet
// bot.onText(/\/limits/, async (msg) => {
// const chatId = msg.chat.id
// const {
// payment_address,
// days,
// subscription_cost: _subscription_cost,
// one_time_cost,
// user_volume: _user_volume,
// } = await get_user_limits()

// const subscription_cost = satoshi_to_BTC(_subscription_cost)
// const user_volume = satoshi_to_BTC(_user_volume)

// const paymentDetails = `
// Your current limits and payment info:
// Payment Address: ${payment_address}
// BTC Volume Permitted Every ${days} Days:
// Subscription Cost: ${subscription_cost}
// Cost to purchase 1 additional BTC in scan volume: ${one_time_cost} satoshis
// You have scanned ${user_volume} BTC so far this billing period.
// `
// bot.sendMessage(chatId, paymentDetails)
// })

0 comments on commit ad5615c

Please sign in to comment.