From 0fbf301e0f9e5e538ab257a1667b6d8619145276 Mon Sep 17 00:00:00 2001 From: Jos Ahrens Date: Sat, 2 Feb 2019 11:01:37 +0000 Subject: [PATCH] plugin/ctcp: Let the user know a CTCP request was sent Because responding to a CTCP request is completely optional, sometimes thelounge will just do absolutely nothing. (the request was received, but the client did not respond to it) This alleviates the problem by always notifying the user that *something* was sent. --- src/plugins/inputs/ctcp.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/inputs/ctcp.js b/src/plugins/inputs/ctcp.js index ab89014b..41237285 100644 --- a/src/plugins/inputs/ctcp.js +++ b/src/plugins/inputs/ctcp.js @@ -1,9 +1,23 @@ "use strict"; +const Msg = require("../../models/msg"); + exports.commands = ["ctcp"]; exports.input = function({irc}, chan, cmd, args) { - if (args.length > 1) { - irc.ctcpRequest(...args); + if (args.length < 2) { + chan.pushMessage(this, new Msg({ + type: Msg.Type.ERROR, + text: "Usage: /ctcp ", + })); + return; } + + chan.pushMessage(this, new Msg({ + type: Msg.Type.CTCP_REQUEST, + ctcpMessage: `"${args.slice(1).join(" ")}" to ${args[0]}`, + from: chan.getUser(irc.user.nick), + })); + + irc.ctcpRequest(...args); };