From 7b00264d2dec7770ccb43a8db86e5e26d8802adf Mon Sep 17 00:00:00 2001 From: koi-chan Date: Thu, 7 Jan 2021 15:38:38 +0900 Subject: [PATCH] =?UTF-8?q?BCDice:=20=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rgrb/plugin/bcdice/discord_adapter.rb | 2 +- lib/rgrb/plugin/bcdice/generator.rb | 2 +- lib/rgrb/plugin/bcdice/irc_adapter.rb | 2 +- spec/rgrb/plugin/bcdice/generator_spec.rb | 10 ++++------ 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/rgrb/plugin/bcdice/discord_adapter.rb b/lib/rgrb/plugin/bcdice/discord_adapter.rb index ff1c1bc5..62760225 100644 --- a/lib/rgrb/plugin/bcdice/discord_adapter.rb +++ b/lib/rgrb/plugin/bcdice/discord_adapter.rb @@ -46,7 +46,7 @@ def bcdice(m, command, specified_game_title) # ゲームシステム名を含むヘッダ header = "#{header_common}<#{result.game_name}>: " - send_channel(m.channel, result.message_lines, header) + send_channel(m.channel, result.message, header) end # git submodule で組み込んでいる BCDice のバージョンを出力する diff --git a/lib/rgrb/plugin/bcdice/generator.rb b/lib/rgrb/plugin/bcdice/generator.rb index 385b6f11..8f58bfc7 100644 --- a/lib/rgrb/plugin/bcdice/generator.rb +++ b/lib/rgrb/plugin/bcdice/generator.rb @@ -12,7 +12,7 @@ module Plugin # BCDice のラッパープラグイン module Bcdice # BCDice の呼び出し結果 - BcdiceResult = Struct.new(:message_lines, :game_name) + BcdiceResult = Struct.new(:message, :game_name) # Bcdice の出力テキスト生成器 class Generator diff --git a/lib/rgrb/plugin/bcdice/irc_adapter.rb b/lib/rgrb/plugin/bcdice/irc_adapter.rb index e5c803fd..0867acd5 100644 --- a/lib/rgrb/plugin/bcdice/irc_adapter.rb +++ b/lib/rgrb/plugin/bcdice/irc_adapter.rb @@ -46,7 +46,7 @@ def bcdice(m, command, specified_game_title) # ゲームシステム名を含むヘッダ header = "#{header_common}<#{result.game_name}>: " - send_notice(m.target, result.message_lines, header) + send_notice(m.target, result.message, header) end # git submodule で組み込んでいる BCDice のバージョンを出力する diff --git a/spec/rgrb/plugin/bcdice/generator_spec.rb b/spec/rgrb/plugin/bcdice/generator_spec.rb index 72f0c275..1a3636c8 100644 --- a/spec/rgrb/plugin/bcdice/generator_spec.rb +++ b/spec/rgrb/plugin/bcdice/generator_spec.rb @@ -11,7 +11,7 @@ describe '#bcdice_version' do it 'BCDice のバージョンを出力する' do expect(generator.bcdice_version).to( - match(/\ABCDice Version: [0-9]\.[0-9]{2}\.[0-9]{2} \([0-9a-f]{40}\)\z/) + match(/\ABCDice Version: [0-9]\.[0-9]{2}\.[0-9]{2}\z/) ) end end @@ -31,12 +31,11 @@ subject { generator.bcdice('2d6') } it 'ゲームシステムとして DiceBot が選ばれる' do - expect(subject.game_type).to eq('DiceBot') expect(subject.game_name).to eq('DiceBot') end it '2d6 の結果が返る' do - expect(subject.message_lines[0].start_with?('(2D6) > ')).to be(true) + expect(subject.message.start_with?('(2D6) > ')).to be(true) end end end @@ -52,15 +51,14 @@ context('ソード・ワールド2.0') do context('k20') do - subject { generator.bcdice('k20', 'SwordWorld2_0') } + subject { generator.bcdice('k20', 'SwordWorld2.0') } it 'ゲームシステムとして「ソード・ワールド2.0」が選ばれる' do - expect(subject.game_type).to eq('SwordWorld2.0') expect(subject.game_name).to eq('ソードワールド2.0') end it 'k20 の結果が返る' do - expect(subject.message_lines[0].start_with?('KeyNo.20c')).to be(true) + expect(subject.message.start_with?('KeyNo.20c')).to be(true) end end end