<commit_before># vim: fileencoding=utf-8

require 'cinch'
require 'rgrb/plugin/util/notice_multi_lines'

require 'rgrb/../../vendor/BCDice/src/cgiDiceBot'

module RGRB
  module Plugin
    # BCDice のラッパープラグイン
    module Bcdice
      # Bcdice の IRC アダプター
      class IrcAdapter
        include Cinch::Plugin
        include Util::NoticeMultiLines

        set(plugin_name: 'Bcdice')
        self.prefix = '.bcdice'
        match(/[ 　]+([A-z0-9@]+)[ 　]+([A-z0-9]+)/, method: :bcdice)

        def initialize(*args)
          super

          @bcdice = CgiDiceBot.new
        end

        # BCDice でダイスを振る
        # @param [Cinch::Message] m 送信されたメッセージ
        # @param [String] command ダイスコマンド
        # @param [String] gameType ゲームタイプ
        # @return [void]
        def bcdice(m, command, gameType = '')
          result = @bcdice.roll(command, gameType)
          message = result[0].lstrip
          m.target.send(message, true)
        end
      end
    end
  end
end<commit_msg>bcdice: ログを残すようにした<commit_after># vim: fileencoding=utf-8

require 'cinch'
require 'rgrb/plugin/util/notice_multi_lines'

require 'rgrb/../../vendor/BCDice/src/cgiDiceBot'

module RGRB
  module Plugin
    # BCDice のラッパープラグイン
    module Bcdice
      # Bcdice の IRC アダプター
      class IrcAdapter
        include Cinch::Plugin
        include Util::NoticeMultiLines

        set(plugin_name: 'Bcdice')
        self.prefix = '.bcdice'
        match(/[ 　]+([A-z0-9@]+)[ 　]+([A-z0-9]+)/, method: :bcdice)

        def initialize(*args)
          super

          @bcdice = CgiDiceBot.new
        end

        # BCDice でダイスを振る
        # @param [Cinch::Message] m 送信されたメッセージ
        # @param [String] command ダイスコマンド
        # @param [String] gameType ゲームタイプ
        # @return [void]
        def bcdice(m, command, gameType = '')
          log_incoming(m)

          result = @bcdice.roll(command, gameType)
          message = result[0].lstrip

          log_notice(m.target, message)
          m.target.send(message, true)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11831124202258222, 'fraction_numerical': 0.005891016200294551, 'mean_word_length': 2.069277108433735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4653343', 'n_tokens_mistral': 790, 'n_tokens_neox': 772, 'n_words': 151}