wiki.ziemers.de

ziemer's informatik Wiki

Benutzer-Werkzeuge

Webseiten-Werkzeuge


wiki:software:beuthbot:bot

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
wiki:software:beuthbot:bot [12.12.2019 13:07]
Christopher Lehmann
wiki:software:beuthbot:bot [07.05.2020 16:31] (aktuell)
Thomas Ziemer
Zeile 2: Zeile 2:
  
 > [[https://telegram.org/|Telegram]] Bot build for the //BeuthBot//-Project, with easy extensibility and customization in mind. > [[https://telegram.org/|Telegram]] Bot build for the //BeuthBot//-Project, with easy extensibility and customization in mind.
 +
 +{{page>.:bot:ergaenzung}}
  
 ==== Table of content ==== ==== Table of content ====
Zeile 34: Zeile 36:
  
 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.
 +
 +
  
 <code> <code>
Zeile 47: Zeile 51:
 ==== 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. `index.jscontains the fundamental logic. The bot get created with its token and waits for incoming events. For example an incoming message. The bot then calls a handler function.+The bot is separated into two files. ''index.js'' contains the fundamental logic. The bot get created with its token and waits for incoming events. For example an incoming message. The bot then calls a handler function.
  
-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, ''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.
  
 ==== Functionalities ==== ==== Functionalities ====
Zeile 61: Zeile 65:
 The bot supports three different kinds of user requests: The bot supports three different kinds of user requests:
  
-- **Message**: A user sends a message to the bot. We then check if the message contains a command. Commands are declared with a prefixed `/in _Telegram_ +- **Message**: A user sends a message to the bot. We then check if the message contains a command. Commands are declared with a prefixed '/in //Telegram//.\\ 
-- **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, and options object and the reference to the function that renders the answer for the specific command.+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, and options object and the reference to the function that renders the answer for the specific command.
  
-```js+<code javascript>
 const commands = { const commands = {
  '/help': {  '/help': {
Zeile 108: Zeile 114:
   }   }
 } }
-```+</code>
  
 === 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 _Commands_), _Callback Queries_ and _Inline Queries_.+Further are functions provided to handle Messages (containing normal //Commands//), //Callback Queries// and //Inline Queries//.
  
 The bot has the following functionalities, that a user can request and use: The bot has the following functionalities, that a user can request and use:
  
-- getTimestamp: Get the timestamp of the moment the message containing this command was send. +- getTimestamp: Get the timestamp of the moment the message containing this command was send.\\ 
-- getFormatedTimestamp: Renders the timestamp in Zulu or German format, this is a function used to answer a _Callback Query_+- getFormatedTimestamp: Renders the timestamp in Zulu or German format, this is a function used to answer a //Callback Query//.\\ 
-- renderHelpString: Iterates over the _commands_-object and prints all available commands and there description. +- renderHelpString: Iterates over the //commands//-object and prints all available commands and there description.\\ 
-- supportedMarkdown: This function gives the User a list of supported [_Markdown_](https://markdown.de/markup by Telegram.+- supportedMarkdown: This function gives the User a list of supported [[https://markdown.de/|Markdown]] markup by Telegram.\\
  
 === BotFather === === BotFather ===
  
-The [BotFather](https://core.telegram.org/botsallows so configure our bot. You can just write the _BotFather_ with Telegram and the bot will guide you through everything. The _BotFather_ enables you among others to change the profile picture, description and about text of your bot.+The [[https://core.telegram.org/bots|BotFather]] allows so configure our bot. You can just write the //BotFather// with Telegram and the bot will guide you through everything. The //BotFather// enables you among others to change the profile picture, description and about text of your bot.
  
 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 131: Zeile 137:
 The neccessary commands are: The neccessary commands are:
  
-`/setcommands` +'/setcommands' 
-`/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:software:beuthbot:bot#commands|commands]].
  
 ==== Further Reading ==== ==== Further Reading ====
  
-- [Telegram Bot APi](https://core.telegram.org/bots/api)+- [[https://core.telegram.org/bots/api|Telegram Bot API]]
  
 ==== Built With ==== ==== Built With ====
  
-- [Node.js](https://nodejs.org/en/+- [[https://nodejs.org/en/|Node.js]]\\ 
-- [Express.js](https://expressjs.com/) +- [[https://expressjs.com/|Express.js]]\\ 
-- [Node-Telegram-Bot-API](https://github.com/yagop/node-telegram-bot-api)+- [[https://github.com/yagop/node-telegram-bot-api|Node-Telegram-Bot-API]]\\
  
 ==== Versioning ==== ==== Versioning ====
  
-We use [SemVer](http://semver.org/for versioning. For the versions available, see the [tags on this repository](https://github.com/T0biWan/heftigwolf-bot/tags).+We use [[http://semver.org/|SemVer]] for versioning. For the versions available, see the [[https://github.com/beuthbot/telegram-bot/tags|tags on this repository]].
  
 ==== Authors ==== ==== Authors ====
  
-- **Tobias Klatt** - _Initial work_ - [GitHub](https://github.com/T0biWan/+- **Tobias Klatt** - //Initial work// - [[https://github.com/T0biWan/|GitHub]]
- +
-See also the list of [contributors](https://github.com/T0biWan/heftigwolf-bot/graphs/contributors) who participated in this project.+
  
 +See also the list of [[https://github.com/beuthbot/telegram-bot/graphs/contributors|contributors]] who participated in this project.
 +<WRAP pagebreak></WRAP>
wiki/software/beuthbot/bot.1576152478.txt.gz · Zuletzt geändert: 12.12.2019 13:07 von Christopher Lehmann