add cleartopic command

Fixes: https://github.com/thelounge/thelounge/issues/4687
This commit is contained in:
Reto Brunner 2026-02-09 08:16:27 +01:00
commit 91fb1ee343
3 changed files with 17 additions and 1 deletions

View file

@ -793,6 +793,15 @@
</div>
</div>
<div class="help-item">
<div class="subject">
<code>/cleartopic</code>
</div>
<div class="description">
<p>Clear the topic in the current channel.</p>
</div>
</div>
<div class="help-item">
<div class="subject">
<code>/unban nick</code>

View file

@ -4,7 +4,7 @@ import Msg from "../../models/msg";
import {MessageType} from "../../../shared/types/msg";
import {ChanType} from "../../../shared/types/chan";
const commands = ["topic"];
const commands = ["topic", "cleartopic"];
const input: PluginInputHandler = function ({irc}, chan, cmd, args) {
if (chan.type !== ChanType.CHANNEL) {
@ -19,6 +19,11 @@ const input: PluginInputHandler = function ({irc}, chan, cmd, args) {
return;
}
if (cmd === "cleartopic") {
irc.clearTopic(chan.name);
return;
}
const cleanArgs = args.map((s) => s.trim()).filter((s) => s !== "");
if (cleanArgs.length === 0) {

View file

@ -206,6 +206,8 @@ declare module "irc-framework" {
setTopic(channel: string, newTopic: string): void;
clearTopic(channel: string): void;
ctcpRequest(target: string, type: string, ...params: Array<string>): void;
ctcpResponse(target: string, type: string, ...params: Array<string>): void;