start_bot_for_chat {depigner}R Documentation

Set up a Telegram bot


This function set up what is necessary to package to be used in a more easy way by the function provided by the depigner.


  chat_name = Sys.getenv("R_telegram_default_chat_name"),
  bot_name = getOption("depigner.bot_name")



(chr, NA) The name of the chat you want to the bot linked to. If NA (default) it uses the default chat of the bot.


(chr, NULL) This argument should be left NULL. If NULL, the function bring the bot name from the environmental variable "R_telegram_bot_name". You can pass another bot's name here as a character string too (note that in this case in the .Renviron you must have an entry like 'R_TELEGRAM_BOT_<yourbotname>=......' containing the token related to the bot).


Before you can use the depigner facilities (or the ones) to use your bot to chat with Telegram from R, you have to set the bot up.

To set up a bot in telegram, find @BotFather on telegram. Send the message \start to it, and then send the message \newbot to it too. Next you have to follow the very simple instruction it gives you. At the end of the process, save your bot token and never share it publicly!!

After your bot is created, go to your bot default chat profile and send the message \start.

Now you can return to R and put both the bot's name and token into the .Renviron file. To access to it you can use edit_r_environ which will open the '.Renviron' file, ready to be modified.

You need to insert two lines, namely the one for your bot's name:


and one for its token:


Next, restart R and you are ready to use al the (simple) functionality of the depigner package, or the flexible and complete ones from the package.




## Not run: 

## End(Not run)

[Package depigner version 0.8.4 Index]