mastodon_command 0.1.8 → 0.1.10
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/.travis.yml +2 -2
- data/README.md +4 -4
- data/lib/mastodon_command/{convert.rb → converter.rb} +2 -3
- data/lib/mastodon_command/{convert_lang.rb → lang_converter.rb} +3 -4
- data/lib/mastodon_command/random_converter.rb +7 -0
- data/lib/mastodon_command/statuses_controller_patch.rb +16 -13
- data/lib/mastodon_command/version.rb +1 -1
- data/lib/mastodon_command.rb +6 -17
- data/mastodon_command.gemspec +1 -1
- metadata +7 -7
- data/lib/mastodon_command/convert_random.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aceb7bcdeb04a6e01f2c4e67e24b944bd064ea6849e26b6a080fcfff9be7a01
|
4
|
+
data.tar.gz: 90540b8a90c4c9b408a62a1974c34cf37e7517aad5fdf973032ff6381ae7c507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad72f5a17f8b1e1ae0449bd8ef82cf98b910226ec090bdfba6f033f8f94ad9061cc874756021a756d63608c832811646de0554c6cafbcc23fc42e95715e35e5
|
7
|
+
data.tar.gz: f174e8e7d8b5f2f5be1f15ad01c6a26bef9f046f2740ab1fdaae395270e94b710ea16fbbcee847432a2c1a776e2ade9af4b465e70f785d34163c03427aa5fade
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# MastodonCommand
|
2
2
|
- おみくじ機能や大阪弁機能などをつけることができます。
|
3
|
-
- ローカルでマストドンのバージョン3.
|
3
|
+
- ローカルでマストドンのバージョン3.5.0にて動作を確認済み
|
4
4
|
(このプログラムを使って問題が起こっても保証はできないので予めご了承ください🙇♂️)
|
5
5
|
|
6
6
|
## Installation
|
7
7
|
|
8
8
|
```ruby
|
9
|
-
gem 'mastodon_command'
|
9
|
+
gem 'mastodon_command', '0.1.10'
|
10
10
|
```
|
11
11
|
|
12
12
|
## Usage
|
@@ -21,11 +21,11 @@ Rails.application.configure do
|
|
21
21
|
config.after_initialize do
|
22
22
|
MastodonCommand.setup do |status|
|
23
23
|
# おみくじ機能
|
24
|
-
fortune = MastodonCommand::
|
24
|
+
fortune = MastodonCommand::RandomConverter.new('[ \n]?#(おみくじ|占い|運勢)[ \n]?', %w(大吉 中吉 小吉 吉 半吉 凶 大凶))
|
25
25
|
status = fortune.convert(status) if fortune.match(status)
|
26
26
|
|
27
27
|
# 大阪弁機能
|
28
|
-
osaka = MastodonCommand::
|
28
|
+
osaka = MastodonCommand::LangConverter.new('[ \n]?#(大阪弁)[ \n]?', [
|
29
29
|
{
|
30
30
|
pattern: 'です',
|
31
31
|
replace: 'やで'
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module MastodonCommand
|
2
|
-
class
|
3
|
-
|
2
|
+
class LangConverter < MastodonCommand::Converter
|
4
3
|
def convert(input)
|
5
|
-
@replaces.each
|
4
|
+
@replaces.each do |replace|
|
6
5
|
input = input.gsub(/#{replace[:pattern]}/, replace[:replace])
|
7
|
-
|
6
|
+
end
|
8
7
|
input
|
9
8
|
end
|
10
9
|
end
|
@@ -2,19 +2,22 @@ module MastodonCommand
|
|
2
2
|
module StatusesControllerPatch
|
3
3
|
def create
|
4
4
|
status = MastodonCommand.convert_toot(status_params[:status])
|
5
|
-
@status = PostStatusService.new.call(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
5
|
+
@status = PostStatusService.new.call(
|
6
|
+
current_user.account,
|
7
|
+
text: status,
|
8
|
+
thread: @thread,
|
9
|
+
media_ids: status_params[:media_ids],
|
10
|
+
sensitive: status_params[:sensitive],
|
11
|
+
spoiler_text: status_params[:spoiler_text],
|
12
|
+
visibility: status_params[:visibility],
|
13
|
+
language: status_params[:language],
|
14
|
+
scheduled_at: status_params[:scheduled_at],
|
15
|
+
application: doorkeeper_token.application,
|
16
|
+
poll: status_params[:poll],
|
17
|
+
idempotency: request.headers['Idempotency-Key'],
|
18
|
+
with_rate_limit: true
|
19
|
+
)
|
20
|
+
|
18
21
|
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
|
19
22
|
end
|
20
23
|
end
|
data/lib/mastodon_command.rb
CHANGED
@@ -1,25 +1,14 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'mastodon_command/version'
|
2
|
+
require 'mastodon_command/converter'
|
3
|
+
require 'mastodon_command/random_converter'
|
4
|
+
require 'mastodon_command/lang_converter'
|
5
|
+
require 'mastodon_command/statuses_controller_patch'
|
6
6
|
|
7
7
|
module MastodonCommand
|
8
8
|
def self.setup(&proc)
|
9
|
-
|
10
|
-
extend self
|
11
|
-
(
|
12
|
-
class << self;
|
13
|
-
self
|
14
|
-
end).module_eval do
|
15
|
-
define_method 'convert_toot', &proc
|
16
|
-
# define_method 'b' do
|
17
|
-
# p 'b'
|
18
|
-
# end
|
19
|
-
end
|
9
|
+
define_singleton_method(:convert_toot, &proc)
|
20
10
|
|
21
11
|
# Monkey patch
|
22
12
|
Api::V1::StatusesController.prepend(MastodonCommand::StatusesControllerPatch)
|
23
13
|
end
|
24
14
|
end
|
25
|
-
|
data/mastodon_command.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
-
spec.add_development_dependency "bundler", "~>
|
32
|
+
spec.add_development_dependency "bundler", "~> 2.2.0"
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mastodon_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kenchiki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,9 +68,9 @@ files:
|
|
68
68
|
- bin/console
|
69
69
|
- bin/setup
|
70
70
|
- lib/mastodon_command.rb
|
71
|
-
- lib/mastodon_command/
|
72
|
-
- lib/mastodon_command/
|
73
|
-
- lib/mastodon_command/
|
71
|
+
- lib/mastodon_command/converter.rb
|
72
|
+
- lib/mastodon_command/lang_converter.rb
|
73
|
+
- lib/mastodon_command/random_converter.rb
|
74
74
|
- lib/mastodon_command/statuses_controller_patch.rb
|
75
75
|
- lib/mastodon_command/version.rb
|
76
76
|
- mastodon_command.gemspec
|