Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
that.winston.debug(that.chatBot.name+"/"+that.name+": Using passed-in nodemailer");
this.nodemailer = this.options.nodemailer;
} else if(this.options.address) {
try {
that.winston.debug(that.chatBot.name+"/"+that.name+": Attempting to create nodemailer transport");
if(that.options.sendmailPath) {
var sendmailTransport = require('nodemailer-sendmail-transport');
that.nodemailer = nodemailer.createTransport(sendmailTransport({path:that.options.sendmailPath,args:that.options.sendmailArgs||undefined}));
} else if(that.options.smtpPoolOptions) {
var smtpPool = require('nodemailer-smtp-pool');
that.nodemailer = nodemailer.createTransport(smtpPool(that.options.smtpPoolOptions));
} else {
var directTransport = require('nodemailer-direct-transport');
that.nodemailer = nodemailer.createTransport(directTransport({name:that.options.hostname||"steam-chat-bot",debug:that.options.debug}));
}
if(that.options.debug){ nodemailer.on('log', function(item){ that.winston.debug(that.chatBot.name+"/"+that.name,item); }); }
} catch(err) {
that.winston.error(that.chatBot.name+"/"+that.name+": Failed to create nodemailer transport",err.stack);
}
}
this.hashfunc = this.options.hashfunc || function(address) {
var crypto = require('crypto');
var shasum = crypto.createHash('sha256');
shasum.update(that.name+address); //don't let users guess the verification code.
return shasum.digest('base64').substring(5,15).toLowerCase(); //keep it short (sha256 is too long). Lowercase - issue with command parser, lazy fix doesn't really matter here.
}
if(that.options.saveTimer !== -1) {
var timerid = setInterval(function(){
try {
that.winston.silly(that.chatBot.name+"/"+that.name+": Writing database to disk");
if(!fnd.ws(that.options.dbFile,JSON.stringify(that.db))) { //this should be changed to a database soon.