misskey 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/README.md +51 -3
- data/lib/create.rb +67 -17
- data/lib/misskey.rb +26 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ea84373b52dedf73ef21f31937e5209d0f48b187090f73d935959496da25d02
|
|
4
|
+
data.tar.gz: 509c6f8655424ef9d7420262db58def2feb0d9b4c083d20415a2782796320e4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26869141756d27a4948a9b3dc953d9b24cf375f6776583d092e3343e1f7610cf4c9c17a0c3a5bc1fa2693a4a930877f05f7d322c7b5490260c087dddf498cfa8
|
|
7
|
+
data.tar.gz: 05d274f648741d2ef61b726089d0745401326166a0e071f9ddb2be24057eb9594b57e14c8183fd778553fe53b8264deb071d03f698e4102cda77568f4c895459
|
data/README.md
CHANGED
|
@@ -19,7 +19,7 @@ When contributing please make sure to follow these guidelines. These may change
|
|
|
19
19
|
|
|
20
20
|
1) No LLM-generated commits please! Vibecoded software tends to get really messy and introduce more issues than it solves. Also everything around LLMs are highly unethical and I don't want to support that. Thanks!
|
|
21
21
|
|
|
22
|
-
2) Please do not create multiple
|
|
22
|
+
2) Please do not create multiple methods that do the same thing.
|
|
23
23
|
|
|
24
24
|
3) Follow common sense.
|
|
25
25
|
|
|
@@ -138,7 +138,7 @@ As the note body suggests, this is a local note that has a content warning.
|
|
|
138
138
|
|
|
139
139
|
You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/notes/POST/notes/create) for more info.
|
|
140
140
|
|
|
141
|
-
#### `Misskey.notes.
|
|
141
|
+
#### `Misskey.notes.reply`
|
|
142
142
|
Very similar to `Misskey.notes.create` except it features a new required argument called `replyId`.
|
|
143
143
|
|
|
144
144
|
Arguments for this are as follows: `replyId` (REQUIRED), `noteContent` (REQUIRED), visibility, localOnly, cw
|
|
@@ -150,7 +150,7 @@ require "misskey"
|
|
|
150
150
|
Misskey.auth.token = "tokenwaaaaaaa"
|
|
151
151
|
Misskey.auth.instanceURI = "sharkey.skydevs.me"
|
|
152
152
|
|
|
153
|
-
Misskey.notes.
|
|
153
|
+
Misskey.notes.reply "someReplyId", "Hello there, this is a reply."
|
|
154
154
|
```
|
|
155
155
|
You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/notes/POST/notes/create) for more info.
|
|
156
156
|
|
|
@@ -170,6 +170,22 @@ puts Misskey.notes.timeline
|
|
|
170
170
|
```
|
|
171
171
|
You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/notes/POST/notes/timeline) for more info.
|
|
172
172
|
|
|
173
|
+
#### `Misskey.notes.show`
|
|
174
|
+
Retrieves a note of the specified ID.
|
|
175
|
+
|
|
176
|
+
There is one optional argument which is `id`. As the name suggests, it is the ID of the note you'd like to get info about.
|
|
177
|
+
|
|
178
|
+
Here's an example:
|
|
179
|
+
```ruby
|
|
180
|
+
require "misskey"
|
|
181
|
+
|
|
182
|
+
Misskey.auth.token = "tokenwaaaaaaa"
|
|
183
|
+
Misskey.auth.instanceURI = "sharkey.skydevs.me"
|
|
184
|
+
|
|
185
|
+
puts Misskey.notes.show "noteweeewoooo"
|
|
186
|
+
```
|
|
187
|
+
You may refer to the [Misskey API docs](https://sharkey.skydevs.me/api-doc#tag/notes/POST/notes/show) for more info.
|
|
188
|
+
|
|
173
189
|
### `Misskey.getOnlineUsersCount`
|
|
174
190
|
Pretty self-explanatory, gets the number of users online. Using it is really simple, here's an example:
|
|
175
191
|
```ruby
|
|
@@ -329,5 +345,37 @@ end
|
|
|
329
345
|
```
|
|
330
346
|
In this example, `puts message` will print the message JSON data in the terminal when it recieves a quote.
|
|
331
347
|
|
|
348
|
+
##### `Misskey.websocket.notifications.onReply`
|
|
349
|
+
Used with a block; runs said block with an argument contianing the message when you recieve a reply notification.
|
|
350
|
+
|
|
351
|
+
Example:
|
|
352
|
+
```ruby
|
|
353
|
+
require "misskey"
|
|
354
|
+
|
|
355
|
+
Misskey.auth.token = "tokenwaaaaaaa"
|
|
356
|
+
Misskey.auth.instanceURI = "sharkey.skydevs.me"
|
|
357
|
+
|
|
358
|
+
Misskey.websocket.connect
|
|
359
|
+
|
|
360
|
+
Misskey.websocket.notifications.onReply do |message|
|
|
361
|
+
puts message
|
|
362
|
+
end
|
|
363
|
+
```
|
|
364
|
+
In this example, `puts message` will print the message JSON data in the terminal when it recieves a reply.
|
|
365
|
+
|
|
366
|
+
##### `Misskey.websocket.notifications.onMentionOrReply`
|
|
367
|
+
This checks for a reply or mention and acts the same way as the onReply or onMention methods. Refer to those for more info.
|
|
368
|
+
|
|
369
|
+
### `Misskey.debug.debugging`
|
|
370
|
+
true/false value. Prints response information in the console for when you want to debug why a note won't create or something.
|
|
371
|
+
|
|
372
|
+
Example:
|
|
373
|
+
|
|
374
|
+
```ruby
|
|
375
|
+
require "misskey"
|
|
376
|
+
|
|
377
|
+
Misskey.debug.debugging = true
|
|
378
|
+
```
|
|
379
|
+
|
|
332
380
|
## That's all!
|
|
333
381
|
Those are all the features currently implemented, but don't worry, more will be added as time goes on :neofox_heart:
|
data/lib/create.rb
CHANGED
|
@@ -31,11 +31,61 @@ JSON
|
|
|
31
31
|
puts postJSON
|
|
32
32
|
puts response
|
|
33
33
|
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
|
|
37
|
+
instance = "https://#{Misskey.auth.instanceURI}/api/notes/create"
|
|
38
|
+
note = Misskey.notes.show replyId
|
|
39
|
+
|
|
40
|
+
if Misskey.debug.debugging
|
|
41
|
+
puts "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nnote:"
|
|
42
|
+
puts note
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
userId = note["userId"]
|
|
46
|
+
noteVisibility = note["visibility"].strip
|
|
47
|
+
noteVisibilityId = 0
|
|
48
|
+
visibilityId = 0
|
|
49
|
+
|
|
50
|
+
case noteVisibility
|
|
51
|
+
when "public"
|
|
52
|
+
noteVisibilityId = 1
|
|
53
|
+
when "home"
|
|
54
|
+
noteVisibilityId = 2
|
|
55
|
+
when "followers"
|
|
56
|
+
noteVisibilityId = 3
|
|
57
|
+
when "specified"
|
|
58
|
+
noteVisibilityId = 4
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
case visibility
|
|
62
|
+
when "public"
|
|
63
|
+
visibilityId = 1
|
|
64
|
+
when "home"
|
|
65
|
+
visibilityId = 2
|
|
66
|
+
when "followers"
|
|
67
|
+
visibilityId = 3
|
|
68
|
+
when "specified"
|
|
69
|
+
visibilityId = 4
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
if visibilityId >> noteVisibilityId
|
|
73
|
+
visibility = noteVisibility
|
|
74
|
+
|
|
75
|
+
if Misskey.debug.debugging
|
|
76
|
+
puts "Adjusted visibility accordingly."
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if Misskey.debug.debugging
|
|
81
|
+
puts "Note visiblity: #{noteVisibility}"
|
|
82
|
+
puts "Note visibility ID: #{noteVisibilityId}"
|
|
83
|
+
puts "Reply visibility: #{visibility}"
|
|
84
|
+
puts "Reply visibility ID: #{visibilityId}"
|
|
85
|
+
end
|
|
34
86
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
# Visibility: public, home, followers, specified
|
|
38
|
-
postJSON = <<~JSON
|
|
87
|
+
# Visibility: public, home, followers, specified
|
|
88
|
+
postJSON = <<~JSON
|
|
39
89
|
{
|
|
40
90
|
"visibility": "#{visibility}",
|
|
41
91
|
"visibleUserIds": [],
|
|
@@ -45,25 +95,25 @@ JSON
|
|
|
45
95
|
"noExtractMentions": false,
|
|
46
96
|
"noExtractHashtags": false,
|
|
47
97
|
"noExtractEmojis": false,
|
|
48
|
-
"replyId": #{replyId},
|
|
98
|
+
"replyId": "#{replyId}",
|
|
99
|
+
"userId": "#{userId}",
|
|
49
100
|
"renoteId": null,
|
|
50
101
|
"channelId": null,
|
|
51
102
|
"text": "#{noteContent}"
|
|
52
103
|
}
|
|
53
104
|
JSON
|
|
54
105
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
end
|
|
106
|
+
response = HTTParty.post(
|
|
107
|
+
instance,
|
|
108
|
+
body: postJSON,
|
|
109
|
+
headers: {
|
|
110
|
+
'Content-Type' => 'application/json',
|
|
111
|
+
"Authorization" => "Bearer #{Misskey.auth.token}"
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
if Misskey.debug.debugging
|
|
115
|
+
puts postJSON
|
|
116
|
+
puts response
|
|
67
117
|
end
|
|
68
118
|
end
|
|
69
119
|
end
|
data/lib/misskey.rb
CHANGED
|
@@ -43,10 +43,10 @@ module Misskey
|
|
|
43
43
|
def notes
|
|
44
44
|
def create noteContent, visibility = "public", localOnly = false, cw = ""
|
|
45
45
|
Creates.created noteContent, visibility = "public", localOnly = false, cw = ""
|
|
46
|
+
end
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
48
|
+
def reply replyId, noteContent, visibility = "public", localOnly = false, cw = ""
|
|
49
|
+
Creates.replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def timeline limit = 10
|
|
@@ -69,6 +69,27 @@ EOF
|
|
|
69
69
|
|
|
70
70
|
return JSON.parse request.body
|
|
71
71
|
end
|
|
72
|
+
|
|
73
|
+
def show id
|
|
74
|
+
instance = "https://#{Misskey.auth.instanceURI}/api/notes/show"
|
|
75
|
+
|
|
76
|
+
postJSON = <<EOF
|
|
77
|
+
{
|
|
78
|
+
"noteId": "#{id}"
|
|
79
|
+
}
|
|
80
|
+
EOF
|
|
81
|
+
|
|
82
|
+
request = HTTParty.post(
|
|
83
|
+
instance,
|
|
84
|
+
body: postJSON,
|
|
85
|
+
headers: {
|
|
86
|
+
"Content-Type" => "application/json",
|
|
87
|
+
"Authorization" => "Bearer #{Misskey.auth.token}"
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
return JSON.parse request.body
|
|
92
|
+
end
|
|
72
93
|
end
|
|
73
94
|
|
|
74
95
|
def getOnlineUsersCount
|
|
@@ -188,3 +209,5 @@ EOF
|
|
|
188
209
|
end
|
|
189
210
|
|
|
190
211
|
include Misskey
|
|
212
|
+
|
|
213
|
+
Misskey.debug.debugging = false
|