Skip to content

DoogeJ/RustTelegramAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Features

This allows other plugins to send messages using the Telegram Bot API.

Configuration

{
  "Telegram Bot API Key": "[bot id here]:[access token here]",
  "Default ID for messages": -12345,
  "ID for error messages": -12345,
  "Try sending error messages to Telegram": true,
  "Announce plugin (re)load to Telegram": false
}

Getting started

Getting your Bot API Token

  1. Talk to BotFather on Telegram and create a bot
  2. Optional: Add the bot to the chat group you want the messages in (alternatively you can have it talk directly to you)
  3. Get your Bot API Token
  4. Add RawDataBot or another helper to the chat group you want the messages in, or talk to that bot directly (Look for message->chat->id in the JSON output)
  5. Edit TelegramBotAPI.json in the config-directory
  6. Set the API key and chat ID's accordingly
  7. Use oxide.reload TelegramBotAPI in the server console or RCON to reload the plugin

For developers

API Methods

public void SendTelegramMessage(string message, long chatID = 0, bool escape = false, string parseMode = "Markdown")

Send a message. Variables are:

  • message: The message contents
  • chatID: The target ID, if 0 it will use the specified default from the config
  • escape: If set to true, the entire message will be escaped
  • parseMode: The message parse mode, defaults to markdown but you can also use markdown V2 or HTML; see Telegram API Documentation for more information

public string Escape(string Input)

Escape strings to make them Telegram-API friendly; you might want to do this with things like player names, but if you're not using markdown in messages you can also escape the entire message just to be safe.

About

Rust Telegram API plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages