Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
|
wiki:software:beuthbot:bot [12.12.2019 13:04] Christopher Lehmann |
wiki:software:beuthbot:bot [07.05.2020 16:31] (aktuell) Thomas Ziemer |
||
|---|---|---|---|
| Zeile 2: | Zeile 2: | ||
| > [[https:// | > [[https:// | ||
| + | |||
| + | {{page> | ||
| ==== Table of content ==== | ==== Table of content ==== | ||
| Zeile 29: | Zeile 31: | ||
| === Prerequisites === | === Prerequisites === | ||
| - | You will need a current version of [_node_ & _npm_](https:// | + | You will need a current version of [[https:// |
| === Installing === | === Installing === | ||
| Zeile 35: | Zeile 37: | ||
| After cloning the repository, install the dependencies. You can then run the project. | After cloning the repository, install the dependencies. You can then run the project. | ||
| - | ```bash | + | |
| + | |||
| + | < | ||
| # install dependencies | # install dependencies | ||
| - | npm install | + | > npm install |
| + | </ | ||
| + | < | ||
| # serve at localhost: | # serve at localhost: | ||
| - | npm start | + | > npm start |
| - | ``` | + | </ |
| ==== Overview ==== | ==== Overview ==== | ||
| - | The bot is basically a _Node_-_Express_-Backend. Incoming requests are checked and specifically handled. | + | The bot is basically a //Node//-//Express//-Backend. Incoming requests are checked and specifically handled. |
| ==== Structure ==== | ==== Structure ==== | ||
| - | The bot is separated into two files. | + | The bot is separated into two files. |
| - | These handlers can be found in the second file, `commands.js`. This file contains the available commands as an Object. Furthermore does ist contain functions to determine if a message contains a commands and to answer the several requests a user can make. | + | These handlers can be found in the second file, '' |
| ==== Functionalities ==== | ==== Functionalities ==== | ||
| Zeile 59: | Zeile 65: | ||
| The bot supports three different kinds of user requests: | The bot supports three different kinds of user requests: | ||
| - | - **Message**: | + | - **Message**: |
| - | - **Callback Queries**: The bot can answer with a question, providing the user a simple interface, using a button matrix. When the user clicks on of these buttons we get a _callback query_. | + | \\ |
| - | - **Inline Queries**: Users can call our bot from within another chat by prefixing the botname with an `@`. The user can then send a text to the bot, which results in an inline query. The result that the bot gives back is inserted in the chat, where the user called the bot from. | + | - **Callback Queries**: The bot can answer with a question, providing the user a simple interface, using a button matrix. When the user clicks on of these buttons we get a //callback query//.\\ |
| + | \\ | ||
| + | - **Inline Queries**: Users can call our bot from within another chat by prefixing the botname with an '@'. The user can then send a text to the bot, which results in an inline query. The result that the bot gives back is inserted in the chat, where the user called the bot from. | ||
| === Commands === | === Commands === | ||
| - | The `commands.js`-file contains an `commands`-object. Every entry of this object is a supported command. The Key is always the command string, prefixed with `/`, eg: `/help`. The value for these keys is an object containing an description, | + | The '' |
| - | ```js | + | <code javascript> |
| const commands = { | const commands = { | ||
| '/ | '/ | ||
| Zeile 106: | Zeile 114: | ||
| } | } | ||
| } | } | ||
| - | ``` | + | </ |
| === Functions === | === Functions === | ||
| - | The `commands.js`-file provides several functions. Eg. functions to check if a message contains an command and to find out if the requested command is in the `commands`-object, which means it is an supported command. | + | The 'commands.js'-file provides several functions. Eg. functions to check if a message contains an command and to find out if the requested command is in the 'commands'-object, which means it is an supported command. |
| - | Further are functions provided to handle Messages (containing normal | + | Further are functions provided to handle Messages (containing normal |
| The bot has the following functionalities, | The bot has the following functionalities, | ||
| - | - getTimestamp: | + | - getTimestamp: |
| - | - getFormatedTimestamp: | + | - getFormatedTimestamp: |
| - | - renderHelpString: | + | - renderHelpString: |
| - | - supportedMarkdown: | + | - supportedMarkdown: |
| === BotFather === | === BotFather === | ||
| - | The [BotFather](https:// | + | The [[https:// |
| Further you can register the commands and inline queries your bot supports. This allows a cleaner user experience since the bot will then suggest commands and inline queries while the user types. So absolutely do register them! | Further you can register the commands and inline queries your bot supports. This allows a cleaner user experience since the bot will then suggest commands and inline queries while the user types. So absolutely do register them! | ||
| Zeile 129: | Zeile 137: | ||
| The neccessary commands are: | The neccessary commands are: | ||
| - | - `/ | + | - '/ |
| - | - `/setinline` | + | - '/setinline' |
| ==== Further Development ==== | ==== Further Development ==== | ||
| - | New commands can simply added to the `commands`-object but have to follow the presented structure under [Commands](#commands). | + | New commands can simply added to the 'commands'-object but have to follow the presented structure under [[wiki: |
| ==== Further Reading ==== | ==== Further Reading ==== | ||
| - | - [Telegram Bot APi](https:// | + | - [[https:// |
| ==== Built With ==== | ==== Built With ==== | ||
| - | - [Node.js](https:// | + | - [[https:// |
| - | - [Express.js](https:// | + | - [[https:// |
| - | - [Node-Telegram-Bot-API](https:// | + | - [[https:// |
| ==== Versioning ==== | ==== Versioning ==== | ||
| - | We use [SemVer](http:// | + | We use [[http:// |
| ==== Authors ==== | ==== Authors ==== | ||
| - | - **Tobias Klatt** - _Initial work_ - [GitHub](https: | + | - **Tobias Klatt** - //Initial work// - [[https:// |
| - | + | ||
| - | See also the list of [contributors](https:// | + | |
| + | See also the list of [[https:// | ||
| + | <WRAP pagebreak></ | ||