Merge pull request #1449 from dgw/cycle-command

Add /cycle command (a.k.a. /rejoin)
This commit is contained in:
Jérémie Astori 2017-08-31 23:45:54 -04:00 committed by GitHub
commit 220af0e180
4 changed files with 37 additions and 0 deletions

View file

@ -795,6 +795,19 @@
</div>
</div>
<div class="help-item">
<div class="subject">
<code>/rejoin</code>
</div>
<div class="description">
<p>
Leave and immediately rejoin the current channel. Useful to
quickly get op from ChanServ in an empty channel, for example.
</p>
<p>Alias: <code>/cycle</code></p>
</div>
</div>
<div class="help-item">
<div class="subject">
<code>/query nick</code>

View file

@ -28,6 +28,7 @@ const commands = [
"/collapse",
"/connect",
"/ctcp",
"/cycle",
"/deop",
"/devoice",
"/disconnect",
@ -46,6 +47,7 @@ const commands = [
"/query",
"/quit",
"/raw",
"/rejoin",
"/say",
"/send",
"/server",

View file

@ -41,6 +41,7 @@ var inputs = [
"ctcp",
"msg",
"part",
"rejoin",
"action",
"away",
"connect",

View file

@ -0,0 +1,21 @@
"use strict";
var Msg = require("../../models/msg");
var Chan = require("../../models/chan");
exports.commands = ["cycle", "rejoin"];
exports.input = function(network, chan) {
if (chan.type !== Chan.Type.CHANNEL) {
chan.pushMessage(this, new Msg({
type: Msg.Type.ERROR,
text: "You can only rejoin channels."
}));
return;
}
network.irc.part(chan.name, "Rejoining");
network.irc.join(chan.name);
return true;
};