Skip to content

Commit 4e17d90

Browse files
added channel ping function
1 parent f2e86ed commit 4e17d90

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["Logan Kilpatrick <[email protected]>"]
44
version = "0.1.0"
55

66
[deps]
7+
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
78
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
89
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
910

src/Slack.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
module Slack
22

33
using HTTP
4+
using CodecZlib
45
using JSON
56

67
include("send.jl")
78
export
89
sendtoslack,
910
sendattachmenttoslack
1011

12+
include("channel.jl")
13+
export
14+
getchannels
15+
16+
# include("utils.jl")
17+
# export
18+
# convert_HTTP_Response_To_JSON
19+
1120
end # module

src/channel.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Slack
2+
3+
"""
4+
getchannels(token::String)
5+
"""
6+
function getchannels(token::String)
7+
8+
HTTP.setuseragent!("HTTP.jl")
9+
10+
url = "https://slack.com/api/conversations.list?token=$(token)"
11+
12+
r = HTTP.get(url, ["Content-Type" => "application/json"])
13+
14+
return (String(r.body))
15+
16+
end

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ response = sendtoslack(data, endpoint)
2323

2424
response2 = sendattachmenttoslack(attachment, endpoint)
2525
@test response2 == "ok"
26+
27+
response3 = getchannels("xoxp-845623957106-858416094789-850474976673-fbe1028a5c118dbea47abe55096bee55")
28+
println(response3)

0 commit comments

Comments
 (0)