(ipcMain Eletronjs) event is not defined

Recently I’ve been developing a windows application (using Electronjs) that encrypts files. I want it so that when I press the first button in the renderer it sends to the main process asking it to open the open file dialog. I tried this code.
renderer.js

firstButton.addEventListener("click", openFile)
function openFile() {
   ipc.send('open-the-open-dialogue');
}
ipc.on('file-picked', function(event, arg) {
console.log(arg);

}

main.js

ipc.on('open-the-open-dialogue',  
function () {
  var filenames = dialog.showOpenDialogSync({ properties: ['openFile'] });
  if(!filenames) {
    dialog.showErrorBox("ERROR!", "You didn't pick a file to encrypt.")
  }
  event.reply('file-opened', filenames[0]);


}

);

When I tried this code it came up with an error saying event is not defined. So what am I doing wrong?