diff --git a/lib/qbot/db/migrate/20230410_rename_server_config_contents.rb b/lib/qbot/db/migrate/20230410_rename_server_config_contents.rb index 546805d..eb78700 100644 --- a/lib/qbot/db/migrate/20230410_rename_server_config_contents.rb +++ b/lib/qbot/db/migrate/20230410_rename_server_config_contents.rb @@ -5,8 +5,8 @@ def change change_table :server_configs do |t| t.rename :options, :contents - t.change_null :contents, false, {} # default - t.change_default :contents, from: nil, to: {} + t.change_null :contents, false, '{}' # default + t.change_default :contents, from: nil, to: '{}' end end end diff --git a/modules/notes.rb b/modules/notes.rb index 137b187..20292f7 100644 --- a/modules/notes.rb +++ b/modules/notes.rb @@ -6,12 +6,24 @@ module Notes extend Discordrb::Commands::CommandContainer + # rubocop: disable Metrics/MethodLength def self.parse_args_addnote(text) # matches inputs: # name text # "name with spaces" text # 'name with spaces' text - re = /^(?['"]?)(?(?:(?!\k).)+?)\k\s(?.+)$/ + re = / + \A + (?['"]?+) + (? + (?:(?!\k)[^\n])+? + | (?:(?=\k)\S)+? + ) + \k + \s+ + (?.+) + \z + /mx case re.match(text) in { name:, text: } @@ -20,6 +32,7 @@ def self.parse_args_addnote(text) nil end end + # rubocop: enable Metrics/MethodLength command :addnote, { aliases: %i[an .],