Skip to content

Commit

Permalink
v0.11.1; added explicit language code for virtual users
Browse files Browse the repository at this point in the history
  • Loading branch information
aldebogdanov committed May 4, 2024
1 parent baffe81 commit aaf16e8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.11.1 - 2024-05-04
* Added optional language code argument to function `cloregram.validation.users/add`

## 0.11.0 - 2024-04-28
* Added namespace `cloregram.dynamic` with dynamic Vars `*current-user` and `*from-message-id*`
* Added internationalisation logic and namespace `cloregram.texts`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ The `cloregram.validation.users` namespace is responsible for working with virtu
```clojure
(require '[cloregram.validation.users :as u])

(u/add :user-1) ; creates virtual user with username "user-1"
(u/add :user-2) ; creates virtual user with username "user-2"
(u/add :user-1) ; creates virtual user with username "user-1" and default language code "en"
(u/add :user-2 "fr") ; creates virtual user with username "user-2" and language code "fr""

(u/main-message :user-1) ; => nil
(u/last-temp-mesage :user-2) ; => nil
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject io.github.algoflora/cloregram "0.11.0"
(defproject io.github.algoflora/cloregram "0.11.1"
:description "Clojure framework for making complex Telegram Bots/Applications"
;:url "https://cloregram.io"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
Expand Down
4 changes: 2 additions & 2 deletions src/cloregram/impl/validation/users.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
(recur (- t interval) (vuid @v-users))))))))

(defn add-v-user
[vuid]
[vuid lang]
(let [v-user {:id (inc (count @v-users))
:msg-id 0
:main-msg-id nil
:first-name (name vuid)
:last-name nil
:username (name vuid)
:language-code "en"
:language-code lang
:messages (sorted-map)
:waiting-for-response? false}]
(swap! v-users #(assoc % vuid v-user))
Expand Down
8 changes: 4 additions & 4 deletions src/cloregram/validation/users.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

(defn add

"Creates virtual user with username and first-name `vuid`, language-code 'en' and empty mesages storage. Writes this user into test infrastructure virtual users state storage with key `vuid`."
"Creates virtual user with username and first-name `vuid`, optional language-code `lang` or 'en' by default and empty mesages storage. Writes this user into test infrastructure virtual users state storage with key `vuid`."

{:changed "0.9.1"}
{:changed "0.11.1"}

[vuid]
(impl/add-v-user vuid))
([vuid] (impl/add-v-user vuid "en"))
([vuid lang] (impl/add-v-user vuid lang)))

(defn get-v-user-by-vuid

Expand Down

0 comments on commit aaf16e8

Please sign in to comment.