misskey 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/create.rb +2 -0
  3. data/lib/misskey.rb +22 -0
  4. data/lib/websocket.rb +24 -20
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d88e8be4843ee35669b4d1be0ccc11789483cdde2b99f2c59dca1b10e16a82f4
4
- data.tar.gz: d1089026ba9bd55cdf828bf1919f32940a6cde8b86547d27ab4bd1b454049b73
3
+ metadata.gz: d1527fc06bdc69225e59d44b2242cee4e143da12c6820fb7bd60b723e0424a3f
4
+ data.tar.gz: 0af3a1d1bb52423c1d24fdb61f66fe3d88feb72bfd325943587537c69fde1442
5
5
  SHA512:
6
- metadata.gz: bee05d0635b33c51d0aed68552c6b63eccfec3f36a755fd08aeb89c0bf53264f790603ec023abec1f0dd62fb03c4d6a9735889de82a251e0bd6032e1dbc91255
7
- data.tar.gz: 0a3130b5e2e69bd018fb41bff41c6ea88c585cc855d56958c68459f7569fff5d28a9813d838818d40017af9cd0b9c04e99e783f49f77981da58fd44484739bef
6
+ metadata.gz: 703fcc4f5c165c493a53f7814b49dfcee2136b64492c0b961a7b5267d735b4daa365cb237881236a279c455917621dd28f6b0cce9d6b37c560ebec7367e66ecb
7
+ data.tar.gz: 0cd19ee3d233eea92ce8bfaa120a46f72df97d5cc6b5219203d930dbe3711fb8d166f2f4f750b809e596d60418f6ddc1023ae6ddc3107e813eb79d918b81e5f6
data/lib/create.rb CHANGED
@@ -31,6 +31,8 @@ JSON
31
31
  puts postJSON
32
32
  puts response
33
33
  end
34
+
35
+ return response
34
36
  end
35
37
 
36
38
  def replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
data/lib/misskey.rb CHANGED
@@ -12,6 +12,28 @@ module Misskey
12
12
  @@token = nil
13
13
  @@instanceURI = nil
14
14
 
15
+ def users
16
+ def show userId
17
+ instance = "https://#{Misskey.auth.instanceURI}/api/users/show"
18
+
19
+ postJSON = <<EOF
20
+ {
21
+ "userId": "#{userId}"
22
+ }
23
+ EOF
24
+
25
+ request = HTTParty.post(
26
+ instance,
27
+ body: postJSON,
28
+ headers: {
29
+ "Content-Type" => "application/json"
30
+ }
31
+ )
32
+
33
+ return JSON.parse request.body
34
+ end
35
+ end
36
+
15
37
  def auth
16
38
  def token
17
39
  return @@token
data/lib/websocket.rb CHANGED
@@ -28,26 +28,30 @@ module WS
28
28
 
29
29
  case message["body"]["type"]
30
30
  when "notification"
31
- if Misskey.debug.debugging
32
- puts "The notification's note body type is: #{message["body"]["body"]["type"]}"
33
- end
34
-
35
- if @@onMentionDo[0] and message["body"]["body"]["type"] == "mention"
36
- @@onMentionDo[1].call message
37
- elsif @@onReactionDo[0] and message["body"]["body"]["type"] == "reaction"
38
- @@onReactionDo[1].call message
39
- elsif @@onRenoteDo[0] and message["body"]["body"]["type"] == "renote"
40
- @@onRenoteDo[1].call message
41
- elsif @@onQuoteDo[0] and message["body"]["body"]["type"] == "quote"
42
- @@onQuoteDo[1].call message
43
- elsif @@onReplyDo[0] and message["body"]["body"]["type"] == "reply"
44
- @@onReplyDo[1].call message
45
- elsif @@onMentionOrReplyDo[0] and /(reply)|(mention)/.match message["body"]["body"]["type"]
46
- @@onMentionOrReplyDo[1].call message
47
- end
48
-
49
- if @@onNotificationDo[0]
50
- @@onNotificationDo[1].call message
31
+ begin
32
+ if Misskey.debug.debugging
33
+ puts "The notification's note body type is: #{message["body"]["body"]["type"]}"
34
+ end
35
+
36
+ if @@onMentionDo[0] and message["body"]["body"]["type"] == "mention"
37
+ @@onMentionDo[1].call message
38
+ elsif @@onReactionDo[0] and message["body"]["body"]["type"] == "reaction"
39
+ @@onReactionDo[1].call message
40
+ elsif @@onRenoteDo[0] and message["body"]["body"]["type"] == "renote"
41
+ @@onRenoteDo[1].call message
42
+ elsif @@onQuoteDo[0] and message["body"]["body"]["type"] == "quote"
43
+ @@onQuoteDo[1].call message
44
+ elsif @@onReplyDo[0] and message["body"]["body"]["type"] == "reply"
45
+ @@onReplyDo[1].call message
46
+ elsif @@onMentionOrReplyDo[0] and /(reply)|(mention)/.match message["body"]["body"]["type"]
47
+ @@onMentionOrReplyDo[1].call message
48
+ end
49
+
50
+ if @@onNotificationDo[0]
51
+ @@onNotificationDo[1].call message
52
+ end
53
+ rescue => error
54
+ puts Rainbow("An error occurred in the websocket event: ").red + error.to_s
51
55
  end
52
56
  end
53
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: misskey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sky.Bit