2022-06-18 20:25:21 -04:00
|
|
|
const commands = ["away", "back"];
|
|
|
|
import {PluginInputHandler} from "./index";
|
2016-11-19 03:24:39 -05:00
|
|
|
|
2022-06-18 20:25:21 -04:00
|
|
|
const input: PluginInputHandler = function (network, chan, cmd, args) {
|
2016-12-18 04:24:50 -05:00
|
|
|
let reason = "";
|
2016-11-19 03:24:39 -05:00
|
|
|
|
2016-12-18 04:24:50 -05:00
|
|
|
if (cmd === "away") {
|
2018-06-07 12:23:51 -04:00
|
|
|
reason = args.join(" ") || " ";
|
2016-11-19 03:24:39 -05:00
|
|
|
|
|
|
|
network.irc.raw("AWAY", reason);
|
2019-07-17 05:33:59 -04:00
|
|
|
} else {
|
|
|
|
// back command
|
2016-12-18 04:24:50 -05:00
|
|
|
network.irc.raw("AWAY");
|
2016-11-19 03:24:39 -05:00
|
|
|
}
|
|
|
|
|
2016-12-18 04:24:50 -05:00
|
|
|
network.awayMessage = reason;
|
2017-04-28 11:58:14 -04:00
|
|
|
|
|
|
|
this.save();
|
2016-11-19 03:24:39 -05:00
|
|
|
};
|
2022-06-18 20:25:21 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
commands,
|
|
|
|
input,
|
|
|
|
};
|