mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-12-22 12:32:18 -06:00
add EventsSelect component
This commit is contained in:
@@ -34,14 +34,22 @@ module.exports = async (instanceName, options, progressBars, conn, connInstance)
|
||||
const collectionName = file.key || instanceName
|
||||
const collection = (!file.secondaryConnection ? conn : connInstance).collection(collectionName)
|
||||
|
||||
const data = JSON.parse(fs.readFileSync(file.path, 'utf8'))
|
||||
var data;
|
||||
try {
|
||||
data = JSON.parse(fs.readFileSync(file.path, 'utf8'))
|
||||
} catch (err) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Array.isArray(data)) continue
|
||||
data._id = file.path.split('\\').pop().split('.')[0]
|
||||
await collection.findOneAndUpdate({ _id: data._id }, { $set: data }, { upsert: true })
|
||||
progress.increment()
|
||||
} catch (err) {
|
||||
progress.stop()
|
||||
throw { err, file }
|
||||
} finally {
|
||||
progress.increment()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user