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
  • Do you want broadcast text to all chats?
  • Do you want broadcast photo, video and etc?
  • Message editing
  • Message_id for income messages to bot
  • Bot message removing

Was this helpful?

  1. Coding: BJS

Message broadcasting and editing

PreviousBot functionsNextUser functions

Last updated 10 months ago

Was this helpful?

Function

Description

Bot.sendMessage(text)

Send message to current chat. It is simple method with markdown by default.

Bot.sendMessage("Hello from bot")

Api.sendMessage(params)

parse_mode: "HTML", }) By default, chat_id accord to the current chat. (chat.chatid)

Do you want broadcast text to all chats?

Do you want broadcast photo, video and etc?

Message editing

Function

Description

Bot.editMessage(value, message_id)

Simple method for message editing with value and message_id

Bot.editMessage("new text", 20)

Api.editMessageText(params)

message_id - it is unique identificator for all chats of this bot.

We have several methods for editing:

Api.editMessageText

Api.editMessageCaption

Api.editMessageMedia

Message_id for income messages to bot

For income messages to bot: use request.message_id

Example

let msg_id = request.message_id;
Bot.editMessage("new text", msg_id);

Message_id - have unique value for all chats of bot. So we have only one message_id with value "2" and only in one chat.

Bot message removing

In this example bot will remove old messages from bot.

in first command:

Api.sendMessage({
  text: "Hello!",
  // we going to remove this message after 120 sec
  on_result: "removeMsgAfter 120"
})

in command removeMsgAfter:

// user can run this command manually
if(!options){ return }
if(!options.result.message_id){ return }

// extract time delay
let runAfter = parseInt(params);

// run message removing after "runAfter" minutes
Bot.run({
  command: "removeMsg",
  options: { message_id: options.result.message_id },
  run_after: runAfter // in seconds
})

in command removeMsg:

if(!options){ return }

// remove message
Api.deleteMessage({
  message_id: options.message_id
})

// also you can edit message here, make message forwarding and etc
// you have message_id here - so you can do anything

Send message. It is Telegram Bot Api . You can pass any params like text, reply_markup, parse_mode and etc: Api.sendMessage({ text: "Hello, <b>World!</b>",

See command

See command

Advanced method for message editing. Please see full description .

Api.editMessageLiveLocation and etc. Please see .

here
method
here
Bot.runAll
Bot.runAll