Skip to content

Commit

Permalink
issue-156: Review/Implement Bot API 7.3 Changes
Browse files Browse the repository at this point in the history
- Updated fns for the telegram bot api 7.3 release.
- Bumped project and dependency versions.
- Generated pom.
- Minor readme updates for usage docs section.
  • Loading branch information
wdhowe committed Jun 1, 2024
1 parent e47f5e2 commit aaf0518
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 29 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ Each API call is a Clojure function, with docstrings outlining required and opti
## Usage

Documentation is available on the project wiki or github pages. The API docs are generated on cljdoc.
For getting started/examples, documentation is available on the project wiki and github pages.

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

For details on the library API, docs are generated on cljdoc.

- [API Docs](https://cljdoc.org/d/telegrambot-lib/telegrambot-lib/CURRENT/api/telegrambot-lib.core)

## License
Expand All @@ -42,6 +45,6 @@ at <https://www.gnu.org/software/classpath/license.html>.
[gh-actions]: https://github.com/wdhowe/telegrambot-lib/actions
[cljdoc-badge]: https://cljdoc.org/badge/telegrambot-lib/telegrambot-lib
[cljdoc-link]: https://cljdoc.org/d/telegrambot-lib/telegrambot-lib/CURRENT
[clojure-v]: https://img.shields.io/badge/clojure-1.11.2-blue.svg
[clojure-v]: https://img.shields.io/badge/clojure-1.11.3-blue.svg
[clojars]: https://clojars.org/telegrambot-lib
[clojars-badge]: https://img.shields.io/clojars/v/telegrambot-lib.svg
8 changes: 4 additions & 4 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.13.0</version>
<version>2.14.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>fc6a4dae6544e6f6d3ad04ab8f80f43ea61c2272</tag>
<tag>e47f5e254d0449d65863bb3e21ad00d80728674a</tag>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
Expand Down Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>clj-http</groupId>
<artifactId>clj-http</artifactId>
<version>3.12.3</version>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>environ</groupId>
Expand All @@ -79,7 +79,7 @@
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojure</artifactId>
<version>1.11.2</version>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>org.clojure</groupId>
Expand Down
24 changes: 12 additions & 12 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
(defproject telegrambot-lib "2.13.0"
(defproject telegrambot-lib "2.14.0"

;;; Project Metadata
:description "A library for interacting with the Telegram Bot API."
:url "https://github.com/wdhowe/telegrambot-lib"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}

;;; Dependencies, Plugins
:dependencies [[clj-http "3.12.3"]
:dependencies [[clj-http "3.13.0"]
[environ "1.2.0"]
[org.clojure/clojure "1.11.2"]
[org.clojure/clojure "1.11.3"]
[org.clojure/core.async "1.6.681"]
[org.clojure/tools.logging "1.3.0"]
[potemkin "0.4.7"]]

;;; Profiles
;; logback-classic must be 1.3.x due to jdk8 support.
;; See: https://github.com/wdhowe/telegrambot-lib/pull/120/commits/015d31621a3fd5a7f69dcf7c230d76d55f7a47c1
Expand All @@ -22,25 +22,25 @@
[org.clojure/data.json "2.5.0"]]
:plugins [[lein-environ "1.2.0"]]
:resource-paths ["env/dev/resources"]}

;; Makes the 'local' profile available during REPL jack-in.
;; Loads from profiles.clj (git ignored).
:local {}

;; A default test dep for json is required in order for cljdoc-analyze to pass.
:test {:dependencies [[org.clojure/data.json "2.5.0"]
[clj-http-fake/clj-http-fake "1.0.4"]]
:plugins [[lein-environ "1.2.0"]]
:resource-paths ["env/test/resources"]}

;; Profiles for testing json libraries.
:data.json {:dependencies [[org.clojure/data.json "2.5.0"]]}
:cheshire {:dependencies [[cheshire "5.13.0"]]}
:cheshire {:dependencies [[cheshire "5.13.0"]]}
:jsonista {:dependencies [[metosin/jsonista "0.3.8"]]}}

;;; Testing
:test-selectors {:default (complement :json)
:json :json}

;;; Repl
:repl-options {:init-ns telegrambot-lib.core})
18 changes: 11 additions & 7 deletions src/telegrambot_lib/api/methods.clj
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,13 @@
- longitude ; long of new location
Optional
- live_period ; New period in seconds which the location can be updated, starting from the message send date.
; If 0x7FFFFFFF is specified, the location can be updated forever.
- horizontal_accuracy ; 1-1500 meters radius of uncertainty
- heading ; 1-360 degrees direction user is moving
- proximity_alert_radius ; 1-100000 meters max distance for proximity alerts
- reply_markup ; additional interface options"
{:changed "0.2.0"}
{:changed "2.14.0"}

([this content]
(http/request this "editMessageLiveLocation" content))
Expand Down Expand Up @@ -811,9 +813,11 @@
- this ; a bot instance
- chat_id ; target chat or username (@user)
- question ; poll question
- options ; array/list of answer options
- options ; array/list of InputPollOption
Optional
- question_parse_mode ; Mode for parsing entities in the question.
- question_entities ; A JSON-serialized list of special entities that appear in the poll question.
- business_connection_id ; Unique id of the business connection.
- message_thread_id ; id of the target thread of the forum.
- is_anonymous ; true if poll is anonymous
Expand All @@ -830,7 +834,7 @@
- protect_content ; protect content from forwarding/saving
- reply_parameters ; Description of the message to reply to
- reply_markup ; additional interface options"
{:changed "2.13.0"}
{:changed "2.14.0"}

([this content]
(http/request this "sendPoll" content))
Expand Down Expand Up @@ -1606,12 +1610,12 @@
"Use this method to get up to date information about the chat
(current name of the user for one-on-one conversations,
current username of a user, group or channel, etc.).
Returns a Chat object on success.
Returns a ChatFullInfo object on success.
Required
- this ; a bot instance
- chat_id ; target chat or username (@user)"
{:changed "0.2.0"}
{:changed "2.14.0"}
content-map?)

(defmethod get-chat true
Expand Down Expand Up @@ -2090,8 +2094,8 @@

(defmethod get-business-connection false
[this business_connection_id]
(let [content {:business_connection_id business_connection_id}]
(get-business-connection this content)))
(let [content {:business_connection_id business_connection_id}]
(get-business-connection this content)))

(defmulti set-my-commands
"Use this method to change the list of the bot's commands.
Expand Down
8 changes: 4 additions & 4 deletions src/telegrambot_lib/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
- Example: `(create \"12345\")`
- Alternatively, parameters can be passed as a map instead.
- Example: `(create {:bot-token \"12345\"})`
Optional Parameters
- bot-token ; The token id of your bot. (default: load from environment)
- async ; Send API requests async or not. (default: false)
- bot-api ; The Telegram Bot API URL. (default: official hosted API)
Returns: A map data structure of a bot config."
{:changed "2.10.0"}
(fn
Expand All @@ -35,12 +35,12 @@

(defmethod create true
[m]
(merge (conf/cfg) m))
(merge (conf/cfg) m))

(defmethod create false
([]
(create {}))

([bot-token]
(create {:bot-token bot-token})))

Expand Down

0 comments on commit aaf0518

Please sign in to comment.