@@ -51,7 +51,11 @@ class Bot {
51
51
this . formatURLAttachment = this . format . urlAttachment || '<{$displayUsername}> {$attachmentURL}' ;
52
52
// "{$keyName}" => "variableValue"
53
53
// side: "Discord" or "IRC"
54
- this . formatCommandPrelude = this . format . commandPrelude || 'Command sent from {$side} by {$nickname}:' ;
54
+ if ( 'commandPrelude' in this . format ) {
55
+ this . formatCommandPrelude = this . format . commandPrelude ;
56
+ } else {
57
+ this . formatCommandPrelude = 'Command sent from {$side} by {$nickname}:' ;
58
+ }
55
59
56
60
// "{$keyName}" => "variableValue"
57
61
// withMentions: text with appropriate mentions reformatted
@@ -282,9 +286,12 @@ class Bot {
282
286
283
287
if ( this . isCommandMessage ( text ) ) {
284
288
patternMap . side = 'Discord' ;
285
- const prelude = Bot . substitutePattern ( this . formatCommandPrelude , patternMap ) ;
286
289
logger . debug ( 'Sending command message to IRC' , ircChannel , text ) ;
287
- this . ircClient . say ( ircChannel , prelude ) ;
290
+ // if (prelude) this.ircClient.say(ircChannel, prelude);
291
+ if ( this . formatCommandPrelude ) {
292
+ const prelude = Bot . substitutePattern ( this . formatCommandPrelude , patternMap ) ;
293
+ this . ircClient . say ( ircChannel , prelude ) ;
294
+ }
288
295
this . ircClient . say ( ircChannel , text ) ;
289
296
} else {
290
297
if ( text !== '' ) {
@@ -345,9 +352,11 @@ class Bot {
345
352
346
353
if ( this . isCommandMessage ( text ) ) {
347
354
patternMap . side = 'IRC' ;
348
- const prelude = Bot . substitutePattern ( this . formatCommandPrelude , patternMap ) ;
349
355
logger . debug ( 'Sending command message to Discord' , `#${ discordChannel . name } ` , text ) ;
350
- discordChannel . sendMessage ( prelude ) ;
356
+ if ( this . formatCommandPrelude ) {
357
+ const prelude = Bot . substitutePattern ( this . formatCommandPrelude , patternMap ) ;
358
+ discordChannel . sendMessage ( prelude ) ;
359
+ }
351
360
discordChannel . sendMessage ( text ) ;
352
361
return ;
353
362
}
0 commit comments