diff --git a/src/telepathy/bot.cr b/src/telepathy/bot.cr index 9aaf6c0..684078b 100644 --- a/src/telepathy/bot.cr +++ b/src/telepathy/bot.cr @@ -74,8 +74,9 @@ module Telepathy text = message.text.as String if entity.offset == 0 && entity.type == "bot_command" divider_index = (text.index /\s|@/) || text.size + first_space_index = (text.index /\s/) || text.size command = text[1...divider_index] - remaining = text[divider_index..text.size] + remaining = text[first_space_index..text.size] params = remaining.empty? ? ([] of String) : (remaining[1...remaining.size].split ' ') @command_hooks[command]?.try { |command| command.call(update, params) } end