Help with custom telescope command

If there is no references found - automatically call Telescope grep_string for text under cursor. Is it possible?

I could make this solution, which executes the command when you press leader+space or if you execute :GrepCword command

local telescopebuiltin = require("telescope.builtin")
local function grep_cword()
  return telescopebuiltin.grep_string({search = vim.fn.expand("<cword>")})
vim.keymap.set("n", "<leader><space>", grep_cword, {})
vim.api.nvim_create_user_command("GrepCword", grep_cword, {})

Well, what have you tried? What problems did you run into?