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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9237a602f5cd97d2f80244b4c7b248ffd28ebc10c52f5fb610437fbb4b690a51
4
- data.tar.gz: 22d3cc27fc34626812994a947eab75c234442406bf97aeccd691f79b63d64515
3
+ metadata.gz: 65fce95bb97b069cd46d2d9728195193eebf43f4a0c41d22d5ee47c0f03b000a
4
+ data.tar.gz: '086ab8a353eeb6dec55f6de358a983acd1f7d5a5ea415ac032addd014b24099d'
5
5
  SHA512:
6
- metadata.gz: 310da1b6555189654dd4163050b61a5a4e8c10164f959553946e339d6cf6ba984a5d09471b436981d301a7fbe9d4a76a06ed111081cbaafbc922715b9e80dd6a
7
- data.tar.gz: c8c521d92a27cfa067b886890f80e1630c9f4aa19423c0ce791a2036b623fb993dff13d39bd8f92683859ca8096495c1381d3375a889fbae0721e4b9e5e817f2
6
+ metadata.gz: e078f21a05a89a44d6df1673382952c9f5c7bd1d2432a37604b5b92888f57d69798023468b4738c7a07b86cd46687f8c3c628db4c6719df9e1ca00486dc51df8
7
+ data.tar.gz: eee09339a9600fc53ae663ddcfca1bb83853fb81f4dcefac9064789e50e35c196dea8bbb39837657ac915ef0389e3b054484a8eed9bdab3e55e2098328e3d8fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruboty-mastodon (0.1.0)
4
+ ruboty-mastodon (0.2.0)
5
5
  lru_redux
6
6
  mastodon-api
7
7
  ruboty
@@ -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
- rest_client.create_status(message[:body])
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
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Mastodon
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
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.1.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-01 00:00:00.000000000 Z
11
+ date: 2019-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler