LazyBot is an actively developing Open Source framework, which is designed to:
These goals are achieved by the fact that when creating telegram bots using the LazyBot framework:
JAR on release page
In this simple example, let's create a bot that will be able to respond to certain commands sent to it by the user via simple text messages, menus and still be able to return to the past responses of the bot.
<?xml version="1.0" encoding="UTF-8"?>
<Bot token="123" xmlns="http://lazybot.ru"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://lazybot.ru bom.xsd">
<Replies after="/start">
<Reply>
<Message>
<Text>Hello world!</Text>
</Message>
</Reply>
<Reply>
<Menu>
<Text>This is a sample menu</Text>
<ButtonsArray>
<Button>
<ButtonLabel>Button1</ButtonLabel>
<Callback>butt1</Callback>
</Button>
</ButtonsArray>
</Menu>
</Reply>
</Replies>
<Replies after="butt1">
<Reply>
<Menu>
<Text>You pressed "Button1"</Text>
<ButtonsArray>
<BackButton>
<ButtonLabel>Back</ButtonLabel>
<Count>1</Count>
</BackButton>
</ButtonsArray>
</Menu>
</Reply>
</Replies>
</Bot>
// Create a new LazyBot object
LazyBotTG botTG = new LazyBotTG(inputStream);
// or
LazyBotTG botTG = new LazyBotTG("filePath");
// Running the bot
botTG.start();
// Basically, you don't have to do anything else.
// It's easy enough :)
As you can see, we were able to create a simple telegram bot using a couple of lines in an xml file and in our Java application. You may think that even this is already too much, but let's look at the things that we managed to avoid thanks to the use of the LazyBot framework:
However, in the future we can add/change a couple of lines in our xml file and at the same time add new functionality for the bot or completely change it.
Documentation about xml elements and details of the framework implementation is stored in the wiki section.
Apache-2.0