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 f2989ca commit ba7f144
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} :`);
}

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

0 comments on commit ba7f144

Please sign in to comment.