This repository has been archived by the owner on Jul 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/target | ||
/classes | ||
/checkouts | ||
profiles.clj | ||
pom.xml | ||
pom.xml.asc | ||
*.jar | ||
*.class | ||
/.lein-* | ||
/.nrepl-port | ||
/.prepl-port | ||
.hgignore | ||
.hg/ | ||
|
||
# Development | ||
_*.* | ||
|
||
# IDE | ||
/.idea | ||
worlds.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# cloworlds | ||
A Clojure library for interacting with Worlds. | ||
|
||
<a href="https://clojars.org/org.clojars.fun/worlds"> | ||
<img src="https://img.shields.io/clojars/v/org.clojars.fun/worlds.svg" alt="Version" /> | ||
</a> | ||
|
||
## Usage | ||
https://clojars.org/org.clojars.fun/worlds | ||
|
||
## Documentation | ||
To be implemented. | ||
|
||
### License | ||
[GNU General Public License v3.0](./LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Introduction to cloworlds | ||
|
||
TODO: write [great documentation](http://jacobian.org/writing/what-to-write/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(defproject org.clojars.fun/worlds "1.0.0" | ||
:description "A Clojure library for interacting with Worlds." | ||
:url "https://github.com/Whirlsplash/cloworlds" | ||
:license {:name "GPLv3" | ||
:url "https://www.gnu.org/licenses/gpl-3.0.en.html"} | ||
:dependencies [[org.clojure/clojure "1.10.1"] | ||
[http.async.client "1.3.1"]] | ||
:repl-options {:init-ns worlds.core}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(ns worlds.core | ||
(:require [http.async.client :as http])) | ||
|
||
(defn is-vip | ||
"Check if a user currently has VIP status" | ||
[username] | ||
(with-open [client (http/create-client)] ; Spawn client and close at end of use | ||
(let [response (http/GET client "http://www-dynamic.us.worlds.net/cgi-bin/vip.pl" :query {:Username username})] | ||
(-> response | ||
http/await ; Await response | ||
http/string) ; Stringify response | ||
(clojure.string/includes? response "You're already a VIP!")))) ; Check if VIP | ||
|
||
(defn get-info | ||
"Get a user's information" | ||
[username] | ||
(with-open [client (http/create-client)] | ||
(let [response (http/GET client "http://www-dynamic.us.worlds.net/cgi-bin/profile.pl" :query {:username username})] | ||
(-> response | ||
http/await | ||
http/string)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(ns worlds.core-test | ||
(:require [clojure.test :refer :all] | ||
[worlds.core :refer :all])) | ||
|
||
(deftest functions | ||
(testing "is-vip" | ||
; Check if my I (fuwn) have VIP, this SHOULD return FALSE. | ||
(is (= (is-vip "fuwn") false))) | ||
(testing "get-info" | ||
; Check if the character count of my information is 351. This is generally | ||
; not a good way to test if this works but I rarely (or ever) change my | ||
; information so this should work. | ||
(is (= (count (get-info "fuwn"))) 351))) |