Created
July 1, 2017 11:18
Star
You must be signed in to star a gist
bcdice-apiの全ダイスボットの情報収集処理を簡単にする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bcdiceCore" | |
require "diceBot/DiceBot" | |
require "diceBot/DiceBotLoader" | |
class BCDice | |
VERSION = "2.02.70" | |
# BCDiceのコミット11ee56c以降で可能 | |
# @see https://github.com/torgtaitai/BCDice/commit/11ee56c8dfdb00ac232c8b5cbf87a963d37df974 | |
DICEBOTS = DiceBotLoader.collectDiceBots. | |
map { |diceBot| [diceBot.gameType, diceBot] }. | |
to_h. | |
freeze | |
SYSTEMS = DICEBOTS.keys. | |
sort. | |
freeze | |
def dice_command # ダイスコマンドの分岐処理 | |
arg = @message.upcase | |
debug('dice_command arg', arg) | |
output, secret = @diceBot.dice_command(@message, @nick_e) | |
return output, secret if( output != '1' ) | |
output, secret = rollD66(arg) | |
return output, secret unless( output.nil? ) | |
output, secret = checkAddRoll(arg) | |
return output, secret unless( output.nil? ) | |
output, secret = checkBDice(arg) | |
return output, secret unless( output.nil? ) | |
output, secret = checkRnDice(arg) | |
return output, secret unless( output.nil? ) | |
output, secret = checkUpperRoll(arg) | |
return output, secret unless( output.nil? ) | |
output, secret = checkChoiceCommand(arg) | |
return output, secret unless( output.nil? ) | |
output, secret = getTableDataResult(arg) | |
return output, secret unless( output.nil? ) | |
output = nil #BCDiceからの変更点 | |
secret = nil | |
return output, secret | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment