mongodb got error when i use bcdice
node_modules\mongodb\lib\core\sdam\server_description.js:85
this.hosts = this.hosts.map(host => host.toLowerCase());
Code
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
// Connection URL
const url = 'XXXXXXXXX MY HOST';
// Database Name
const dbName = 'myproject';
// Use connect method to connect to the server
MongoClient.connect(url, function (err, client) {
assert.equal(null, err);
console.log("Connected successfully to server");
const db = client.db(dbName);
client.close();
});
var BCDice = require('bcdice').default;
require('bcdice/lib/diceBot/Cthulhu');
function getInfo(gameType) {
return BCDice.infoList.find(info => info.gameType === gameType);
}
function roll(command, gameType) {
var bcdice = new BCDice();
var [result, rands] = bcdice.roll(command, gameType);
return {
result,
rands,
};
}
console.log(getInfo('Cthulhu'))
console.log(roll('CC', 'Cthulhu'));