36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/create.rb', line 36
def replied replyId, noteContent, visibility = "public", localOnly = false, cw = ""
instance = "https://#{Misskey.auth.instanceURI}/api/notes/create"
note = Misskey.notes.show replyId
if Misskey.debug.debugging
puts "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nnote:"
puts note
end
userId = note["userId"]
noteVisibility = note["visibility"].strip
noteVisibilityId = 0
visibilityId = 0
case noteVisibility
when "public"
noteVisibilityId = 1
when "home"
noteVisibilityId = 2
when "followers"
noteVisibilityId = 3
when "specified"
noteVisibilityId = 4
end
case visibility
when "public"
visibilityId = 1
when "home"
visibilityId = 2
when "followers"
visibilityId = 3
when "specified"
visibilityId = 4
end
if visibilityId >> noteVisibilityId
visibility = noteVisibility
if Misskey.debug.debugging
puts "Adjusted visibility accordingly."
end
end
if Misskey.debug.debugging
puts "Note visiblity: #{noteVisibility}"
puts "Note visibility ID: #{noteVisibilityId}"
puts "Reply visibility: #{visibility}"
puts "Reply visibility ID: #{visibilityId}"
end
postJSON = <<~JSON
{
"visibility": "#{visibility}",
"visibleUserIds": [],
"cw": "#{cw}",
"localOnly": #{localOnly},
"reactionAcceptance": null,
"noExtractMentions": false,
"noExtractHashtags": false,
"noExtractEmojis": false,
"replyId": "#{replyId}",
"userId": "#{userId}",
"renoteId": null,
"channelId": null,
"text": "#{noteContent}"
}
JSON
response = HTTParty.post(
instance,
body: postJSON,
headers: {
'Content-Type' => 'application/json',
"Authorization" => "Bearer #{Misskey.auth.token}"
}
)
if Misskey.debug.debugging
puts postJSON
puts response
end
end
|