ruboty-mastodon 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ruboty/adapters/mastodon.rb +16 -1
- data/lib/ruboty/mastodon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65fce95bb97b069cd46d2d9728195193eebf43f4a0c41d22d5ee47c0f03b000a
|
4
|
+
data.tar.gz: '086ab8a353eeb6dec55f6de358a983acd1f7d5a5ea415ac032addd014b24099d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e078f21a05a89a44d6df1673382952c9f5c7bd1d2432a37604b5b92888f57d69798023468b4738c7a07b86cd46687f8c3c628db4c6719df9e1ca00486dc51df8
|
7
|
+
data.tar.gz: eee09339a9600fc53ae663ddcfca1bb83853fb81f4dcefac9064789e50e35c196dea8bbb39837657ac915ef0389e3b054484a8eed9bdab3e55e2098328e3d8fe
|
data/Gemfile.lock
CHANGED
@@ -8,6 +8,7 @@ module Ruboty
|
|
8
8
|
env :MASTODON_BASE_URL, 'Base URL of your mastodon server'
|
9
9
|
env :MASTODON_BEARER_TOKEN, 'API token of your mastodon account'
|
10
10
|
env :MASTODON_IGNORE_BOT_MESSAGE, 'Ignroe bot user message', optional: true
|
11
|
+
env :MASTODON_DEFAULT_VISIBILITY, 'Default visibility(private, unlisted or public. default: public)', optional: true
|
11
12
|
|
12
13
|
def run
|
13
14
|
init
|
@@ -15,7 +16,19 @@ module Ruboty
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def say(message)
|
18
|
-
|
19
|
+
visibility = message[:visibility] || @default_visiblity
|
20
|
+
|
21
|
+
options = {
|
22
|
+
visibility: visibility,
|
23
|
+
media_ids: message[:media_ids],
|
24
|
+
language: message[:language],
|
25
|
+
sensitive: !!message[:sensitive],
|
26
|
+
spoiler_text: message[:spoiler_text],
|
27
|
+
}
|
28
|
+
|
29
|
+
options[:in_reply_to_id] = message[:original][:status].id if visibility != 'public'
|
30
|
+
|
31
|
+
rest_client.create_status(message[:body], options)
|
19
32
|
end
|
20
33
|
|
21
34
|
protected
|
@@ -25,6 +38,8 @@ module Ruboty
|
|
25
38
|
account = rest_client.verify_credentials
|
26
39
|
|
27
40
|
ENV['RUBOTY_NAME'] ||= account.username
|
41
|
+
|
42
|
+
@default_visiblity = %w[public private unlisted].include?(ENV['MASTODON_DEFAULT_VISIBILITY']) ? ENV['MASTODON_DEFAULT_VISIBILITY'] : 'public'
|
28
43
|
end
|
29
44
|
|
30
45
|
def connect
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-mastodon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|