-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from vasani-arpit/development
Development
- Loading branch information
Showing
5 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { constants } = require("crypto"); | ||
/** | ||
* Live settings loader | ||
*/ | ||
|
||
var utils = require("./utils"); | ||
|
||
/** | ||
* This function will load settings from JSON configuration file | ||
* @param {*} event Event name | ||
* @param {*} filename Name of the file | ||
* @param {*} page Handle to webpage | ||
*/ | ||
function loadSettings(event, filename, page) | ||
{ | ||
// Check event type | ||
if(event === "change") | ||
{ | ||
// console.log("Settings changed"); | ||
|
||
// Load JSON settings file | ||
let botJson = utils.externalInjection(filename); | ||
|
||
// Update settings | ||
botJson.then((data) => { | ||
page.evaluate(`var intents = ${data}`); | ||
}).catch((err) => { | ||
console.log(`there was an error ${err}`); | ||
}); | ||
} else if(event === "rename") { | ||
console.log("warn: filename changed"); | ||
} | ||
} | ||
|
||
this.LoadBotSettings = loadSettings; |