Skip to content

Commit

Permalink
Make setTopic() remove the topic if newTopic is falsy
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsOnlyBinary committed Aug 22, 2023
1 parent 8098298 commit f856244
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,14 @@ module.exports = class IrcClient extends EventEmitter {
}

setTopic(channel, newTopic) {
this.raw('TOPIC', channel, newTopic);
if (newTopic && newTopic.trim()) {
this.raw('TOPIC', channel, newTopic);
return;
}

// If newTopic is undefined or empty, remove the existing topic
// this is needed because without the : then it would be requesting the current topic
this.raw(`TOPIC ${channel} :`)

Check failure on line 621 in src/client.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Missing semicolon

Check failure on line 621 in src/client.js

View workflow job for this annotation

GitHub Actions / build (16.x)

Missing semicolon

Check failure on line 621 in src/client.js

View workflow job for this annotation

GitHub Actions / build (19.x)

Missing semicolon
}

ctcpRequest(target, type /*, paramN */) {
Expand Down

0 comments on commit f856244

Please sign in to comment.