Add default keys for show art by message/file conf/areas

This commit is contained in:
Bryan Ashby 2018-11-17 21:04:00 -07:00
parent bf43766355
commit 2a95849f7d
1 changed files with 6 additions and 6 deletions

View File

@ -68,7 +68,7 @@ exports.getModule = class ShowArtModule extends MenuModule {
} }
showByExtraArgs(cb) { showByExtraArgs(cb) {
this.getArtKeyValue( (err, artSpec) => { this.getArtKeyValue(this.config.key, (err, artSpec) => {
if(err) { if(err) {
return cb(err); return cb(err);
} }
@ -89,7 +89,7 @@ exports.getModule = class ShowArtModule extends MenuModule {
} }
showByFileBaseArea(cb) { showByFileBaseArea(cb) {
this.getArtKeyValue( (err, key) => { this.getArtKeyValue('areaTag', (err, key) => {
if(err) { if(err) {
return cb(err); return cb(err);
} }
@ -98,7 +98,7 @@ exports.getModule = class ShowArtModule extends MenuModule {
} }
showByMessageConf(cb) { showByMessageConf(cb) {
this.getArtKeyValue( (err, key) => { this.getArtKeyValue('confTag', (err, key) => {
if(err) { if(err) {
return cb(err); return cb(err);
} }
@ -107,7 +107,7 @@ exports.getModule = class ShowArtModule extends MenuModule {
} }
showByMessageArea(cb) { showByMessageArea(cb) {
this.getArtKeyValue( (err, key) => { this.getArtKeyValue('areaTag', (err, key) => {
if(err) { if(err) {
return cb(err); return cb(err);
} }
@ -133,8 +133,8 @@ exports.getModule = class ShowArtModule extends MenuModule {
return this.displaySingleArtWithOptions(artSpec, options, cb); return this.displaySingleArtWithOptions(artSpec, options, cb);
} }
getArtKeyValue(cb) { getArtKeyValue(defaultKey, cb) {
const key = this.config.key; const key = this.config.key || defaultKey;
if(!_.isString(key)) { if(!_.isString(key)) {
return cb(Errors.MissingConfig('Config option "key" is required for method "extraArgs"')); return cb(Errors.MissingConfig('Config option "key" is required for method "extraArgs"'));
} }