Tutorial fixes

This commit is contained in:
Abbas Abou Daya 2017-10-30 21:21:13 -04:00
parent f5cbe8b953
commit c67d68dcf7
5 changed files with 16 additions and 16 deletions

View File

@ -5,4 +5,4 @@ Once you /backup, the bot will respond back with a valid JSON object that repres
On /recover, the bot will ask for the JSON file. A reply to the message with the file attached will recover the bot with the previous state DB.
Try to experiment using the counter ability introduced in [Database Handling](Database-Handling.md)!
Try to experiment using the counter ability introduced in [[Database Handling|Database-Handling]]!

View File

@ -1,6 +1,6 @@
# Database Handling
AbilityBots come with an embedded DB. Users are free to implement their own databases via implementing the [DBContext](../../telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/DBContext.java) class.
The abstraction has multiple constructors to accommodate user-defined implementations of [DBContext](../../telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/DBContext.java) and [MessageSender](../../telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/MessageSender.java). We'll talk about the message sender interface in the [bot testing](Bot-Testing.md) section.
The abstraction has multiple constructors to accommodate user-defined implementations of [DBContext](../../telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/db/DBContext.java) and [MessageSender](../../telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/sender/MessageSender.java). We'll talk about the message sender interface in the [[Bot Testing|Bot-Testing]] section.
## Example
We'll be introducing an ability that maintains a special counter for every user. At every /increment, the user will receive a message with the previous number + 1. We'll initially start from zero and increment onwards.

View File

@ -72,10 +72,10 @@ The `silent` object is created with every AbilityBot. It provides helper and uti
manage errors by checking for the presence of the optional `.isPresent()`. This decreases verboseness while still being able to execute routines correctly.
Do note that:
* You can still access the bot's methods and functions inside the lambda function in your action definition. That includes all the DefaultAbsSender methods execute, executeAsync, setChatPhoto, etc....
* `silent` uses another accessible object named `sender`. Refer to [[Bot Testing]] for the main use case of sender as an interface to all bot methods.
* `silent` uses another accessible object named `sender`. Refer to [[Bot Testing|Bot-Testing]] for the main use case of sender as an interface to all bot methods.
With abilities, you can specify the context of the feature. If you only want the command to be available for groups, then you can set `.locality(GROUP)`. If it is a very sensitive command that only admins should have access to, then set `.privacy(ADMIN)`.
This allows for abilities with protection guarantees on who can use and where it can be used.
This allows for abilities with protection guarantees on who can use it and where it can be used.
The following is a snippet of how this would look like with the plain basic API.
```java

View File

@ -1,5 +1,5 @@
# AbilityBot
This section of the tutorial will present a barebone example on creating your first AbilityBot! It is highly recommended to write your very first bot via the [simple users guide](./Simple-Example.md). That will give you a sense of how the basic API allows you to handle commands and features.
This section of the tutorial will present a barebone example on creating your first AbilityBot! It is highly recommended to write your very first bot via the [[Getting Started|Getting-Started]]. That will give you a sense of how the basic API allows you to handle commands and features.
## Dependencies
As with any Java project, you will need to set your dependencies.
@ -97,7 +97,7 @@ public class Application {
}
```
If you're in doubt that you're missing some code, the full code example can be inspected [Here]()
If you're in doubt that you're missing some code, the full code example can be inspected [here](https://github.com/addo37/ExampleBots/tree/master/src/main/java/org/telegram/examplebots).
## Testing Your Bot
Go ahead and "/hello" to your bot. It should respond back with "Hello World!".