thelounge/src/plugins/inputs/topic.js
2020-03-21 22:55:36 +02:00

24 lines
434 B
JavaScript

"use strict";
const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
exports.commands = ["topic"];
exports.input = function ({irc}, chan, cmd, args) {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(
this,
new Msg({
type: Msg.Type.ERROR,
text: `${cmd} command can only be used in channels.`,
})
);
return;
}
irc.setTopic(chan.name, args.join(" "));
return true;
};