Skip to content

Commit

Permalink
- updating README.md - adding usage information of the library and de…
Browse files Browse the repository at this point in the history
…pendency in the java code
  • Loading branch information
dostonhamrakulov committed Dec 30, 2023
1 parent 894ac38 commit 2802777
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# java-telegram-bot-calendar
Date and time picker and inline calendar for Java telegram bots
Date and time picker and inline calendar for based Java telegram bots. It is very simple to integrate and use in your bot.

Maven Dependency:
```xml
<dependency>
<groupId>io.github.dostonhamrakulov</groupId>
<artifactId>java-telegram-bot-calendar</artifactId>
<version>1.0</version>
</dependency>
```

In your bot:
```java
import io.github.dostonhamrakulov.InlineCalendarBuilder;
import io.github.dostonhamrakulov.InlineCalendarCommandUtil;

...

InlineCalendarBuilder inlineCalendarBuilder = new InlineCalendarBuilder();

SendMessage sendMessage = new SendMessage();
sendMessage.setReplyMarkup(inlineCalendarBuilder.build(update));
...

// you can check if calendar/date picker is clicked
if (InlineCalendarCommandUtil.isInlineCalendarClicked(update)){
// if ignorable buttons are clicked like empty cells, cells for week days, etc.
if (InlineCalendarCommandUtil.isCalendarIgnoreButtonClicked(update)) {
return;
}

// return to the next or previous months
if (InlineCalendarCommandUtil.isCalendarNavigationButtonClicked(update)) {
sendMessage.setReplyMarkup(inlineCalendarBuilder.build(update));
// execute
return;
}

LocalDate localDate = InlineCalendarCommandUtil.extractDate(update);
}
```

# How to contribute
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
Expand Down

0 comments on commit 2802777

Please sign in to comment.