Bots.Business - Help
  • Welcome
  • Getting started
  • Create bot from Google Table
  • App
    • Reset or Update Your Password
  • Commands
    • Answer
    • Aliases
    • Keyboard
    • Groups
    • Wait for answer
    • Auto Retry (AR)
  • Coding: BJS
    • Variables
    • Bot functions
    • Message broadcasting and editing
    • User functions
    • Properties
    • Always running commands
    • Error command: "!"
    • Lists
      • Migration from properties to list
    • Api functions
    • BB Admin functions
    • Admin Panel
    • Send HTTP request
    • Web App
    • Caching
    • Inline Bot
    • BJS Security
    • Good coding practices
    • Top errors
  • Git
    • Import bot from Git repository
    • Export bot to Git repository
    • Repository structure
    • File: bot.json
    • Automatic importing on Git push
  • Iterations. How to reduce theys?
  • Limitations
  • Cloud
  • Reports
  • Deep Linking - pass any params on Bot starting
  • How to link chat account with BB account?
  • BB Inspection
  • Protected bot
  • VS Code
  • How to...
  • Smart Bot
    • Overview
    • Lang File
    • SmartBot
    • SmartTasker
    • Amount Dialog
  • Libs
    • What it is - Libs?
    • Libs development
    • RefferalLib
    • ResourcesLib
    • Random
    • MembershipChecker (MCL)
    • Cooldown Lib
    • CurrencyConverter
    • Lang
    • TopBoardLib
    • QiwiPayments
    • Coinbase (CB)
    • CoinPayments (CP)
    • OxaPay
    • CryptoJS
    • CurrencyQuote
    • GoogleApp
    • GoogleTableSync
    • Guard
    • Webhooks lib
    • DateTimeFormat Lib
  • Store
    • BB Point Bot
    • Welcome bot
    • Help bot
    • SRB Demo Keyboard Tools
Powered by GitBook
On this page
  • Accept BB Points in your bot
  • How to make?
  • Transfer BB Points 💎 from your bot to users

Was this helpful?

  1. Store

BB Point Bot

PreviousDateTimeFormat LibNextWelcome bot

Last updated 9 months ago

Was this helpful?

BB Point bot helps develop the community. User can echange BB Points to Extra Iterations.

Also it is possible:

  • Accept BB Points 💎 in your bot from users

  • Transfer BB Points 💎 from your bot to users

This functionality is built with . You can do some pretty cool stuff in your bots to share data too.

Accept BB Points in your bot

We can accept BB Points 💎 in any bot now.

How to make?

Step 1

Install Webhook Lib in your bot and make webhook url:

// Generate webhook link for BB Point Bot
let url = Libs.Webhooks.getUrlFor({
 command: "onBBPointIncome"
})

Bot.sendMessage(
 "Set this url in [@BBPointBot](https://t.me/BBPointBot?start=link) " +
 "bot for notification." +
 "\n\nCommand [@BBPointBot > /link](https://t.me/BBPointBot?start=link) "
)

// send url without markup
Api.sendMessage({ text: url });

Step 2

You will get such link for request:

https://t.me/BBPointBot?start=req15-1-points-to-519829299

You can change bb point amount in url part: -XXX-points

You can change user.id after part: -to-user-XXX

Transfer BB Points 💎 from your bot to users

Step 1

Personal secret webhook url with Secret - is safe information.

You can reset the Secret at any time via command /setTransferSecret

Step 2

In your bot command create new command /makeTransfer:

// Danger! User can run this command
// You need add logic for secure
// if(your logic){ return }

// Just generate webhook url for current user
let webhookUrl = Libs.Webhooks.getUrlFor({
  command: "onTransfer",
  user_id: user.id
})

Bot.sendMessage("Transfer in progress")

// make transfer request to BB Point bot
HTTP.post( {
    url: "http://Your Personal secret webhook url from step 1",
         
    body: {
       // BB Points amount
       amount: 3,
       // transfer BB Points for current user
       to_tg_id: user.telegramid,
       // note for @bbpoints channel
       note: "#testTransfer by " + bot.name,
       webhookUrl: webhookUrl,
       secret: "your Secret" // from step 1
    }
} )

This command transfer BB Points without any conditions.

You must add some conditions. You are not going to send BB Points without any reason?

Step 3

In your bot command create new command onTransfer:

var json = JSON.parse(content);

// You can inspect all passed data:
// Bot.inspect(json)

if(json.error){
  Bot.sendMessage("Error: " + json.error.title);
  Bot.sendMessage("Code: " + json.error.code);
  // error codes:
  // 1 - You do not have BB Points for transfer
  return
}

// BB Points transferred to current user
let admin_bb_points = json.owner.bb_points - json.amount;

Bot.sendMessage(
    "BB Points transferred:\n" +
    json.amount + "💎 BB Points to tg id: " + user.telegramid + 

    "\n\nAdmin: @" + json.owner.username + 
       "\n have now: " + String(admin_bb_points) + "💎 BB Points"
)

See example in

See example for /sample3 in

Go to - /link and paste link from step1

Generate your personal secret webhook url in by command: /getTransferUrl

Set Secret (any words or symbols - whatever you want) in by command: /setTransferSecret

@BBWebhookBot
@BBWebhookBot
@BBPointBot
@BBPointBot
@BBPointBot
WebhookLib