Skip to content

Commit

Permalink
issue-145: Review/Implement Bot API 7.0 Changes (#146)
Browse files Browse the repository at this point in the history
* issue-145: Review/Implement Bot API 7.0 Changes

- Added new functions: delete-messages, forward-messages, copy-messages, set-message-reaction, get-user-chat-boosts.
- Optional parameter replacements. (reply_to_message_id and allow_sending_without_reply with the field reply_parameters)
- Optional parameter replacements. (disable_web_page_preview with link_preview_options)
- Readme updates to include github pages and update License years.
- Project and dependency version bumps.
- Generated pom.
  • Loading branch information
wdhowe authored Jan 21, 2024
1 parent ac2a8a9 commit 6e78632
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 68 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ Each API call is a Clojure function, with docstrings outlining required and opti
## Usage

See the [Wiki for documentation](https://github.com/wdhowe/telegrambot-lib/wiki).
Documentation is available on the project wiki and is also published to github pages.

- [Wiki](https://github.com/wdhowe/telegrambot-lib/wiki)
- [Github pages](https://wdhowe.github.io/telegrambot-lib/)

## License

Copyright © 2020-2023 Bill Howe and contributors
Copyright © 2020-2024 Bill Howe and contributors

This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>telegrambot-lib</groupId>
<artifactId>telegrambot-lib</artifactId>
<packaging>jar</packaging>
<version>2.11.0</version>
<version>2.12.0</version>
<name>telegrambot-lib</name>
<description>A library for interacting with the Telegram Bot API.</description>
<url>https://github.com/wdhowe/telegrambot-lib</url>
Expand All @@ -18,7 +18,7 @@
<url>https://github.com/wdhowe/telegrambot-lib</url>
<connection>scm:git:git://github.com/wdhowe/telegrambot-lib.git</connection>
<developerConnection>scm:git:ssh://[email protected]/wdhowe/telegrambot-lib.git</developerConnection>
<tag>b73beb09dbdb0be3341b5e7b6c650c304054933f</tag>
<tag>fba36072cbeac666cdefdf4d0726cfc4218864a2</tag>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
Expand Down Expand Up @@ -94,7 +94,7 @@
<dependency>
<groupId>potemkin</groupId>
<artifactId>potemkin</artifactId>
<version>0.4.6</version>
<version>0.4.7</version>
</dependency>
<dependency>
<groupId>cheshire</groupId>
Expand Down
6 changes: 3 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject telegrambot-lib "2.11.0"
(defproject telegrambot-lib "2.12.0"

;;; Project Metadata
:description "A library for interacting with the Telegram Bot API."
Expand All @@ -12,7 +12,7 @@
[org.clojure/clojure "1.11.1"]
[org.clojure/core.async "1.6.681"]
[org.clojure/tools.logging "1.2.4"]
[potemkin "0.4.6"]]
[potemkin "0.4.7"]]

;;; Profiles
;; logback-classic must be 1.3.x due to jdk8 support.
Expand All @@ -37,7 +37,7 @@

:jsonista {:dependencies [[metosin/jsonista "0.3.8"]]}

:data.json {:dependencies [[org.clojure/data.json "2.4.0"]]}}
:data.json {:dependencies [[org.clojure/data.json "2.5.0"]]}}

;;; Testing
:test-selectors {:default (complement :json)
Expand Down
27 changes: 23 additions & 4 deletions src/telegrambot_lib/api/edit.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
Optional
- parse_mode ; entity parsing in message
- entities ; list of MessageEntity - can use instead of parse_mode
- disable_web_page_preview ; disable link previews
- link_preview_options ; link preview generation options.
- reply_markup ; inline keyboard markup"
{:changed "0.2.0"}
{:changed "2.12.0"}

([this content]
(http/request this "editMessageText" content))
Expand Down Expand Up @@ -55,9 +55,9 @@
Optional
- parse_mode ; entity parsing in message
- disable_web_page_preview ; disable link previews
- link_preview_options ; link preview generation options.
- reply_markup ; inline keyboard markup"
{:added "0.2.0"}
{:changed "2.12.0"}

([this content]
(http/request this "editMessageText" content))
Expand Down Expand Up @@ -286,3 +286,22 @@
(let [content {:chat_id chat_id
:message_id message_id}]
(delete-message this content))))

(defn delete-messages
"Use this method to delete multiple messages simultaneously.
If some of the specified messages can't be found, they are skipped.
Returns True on success.
Required
- this ; a bot instance
- chat_id ; target chat or username (@user)
- message_ids ; List of IDs, 1-100 messages to delete."
{:added "2.12.0"}

([this content]
(http/request this "deleteMessages" content))

([this chat_id message_ids]
(let [content {:chat_id chat_id
:message_ids message_ids}]
(delete-messages this content))))
5 changes: 2 additions & 3 deletions src/telegrambot_lib/api/games.clj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
- message_thread_id ; id of the target thread of the forum.
- disable_notification ; send message silently
- protect_content ; protect content from forwarding/saving
- reply_to_message_id ; id of original message
- allow_sending_without_reply ; true to send message even if replied-to message is not found
- reply_parameters ; Description of the message to reply to
- reply_markup ; inline keyboard markup"
{:changed "0.2.0"}
{:changed "2.12.0"}

([this content]
(http/request this "sendGame" content))
Expand Down
Loading

0 comments on commit 6e78632

Please sign in to comment.