mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-08 00:32:19 +02:00
34 lines
616 B
JavaScript
34 lines
616 B
JavaScript
"use strict";
|
|
import socket from "../socket";
|
|
import store from "../store";
|
|
|
|
function input(args) {
|
|
if (args.length === 0) {
|
|
const {channel} = store.state.activeChannel;
|
|
|
|
socket.emit("input", {
|
|
target: channel.id,
|
|
text: `/favorite ${channel.name}`,
|
|
});
|
|
} else {
|
|
for (const arg of args) {
|
|
for (const network of store.state.networks) {
|
|
const channel = network.channels.find((c) => c.name === arg);
|
|
|
|
if (!channel) {
|
|
continue;
|
|
}
|
|
|
|
socket.emit("input", {
|
|
target: channel.id,
|
|
text: `/favorite ${channel.name}`,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
export default {input};
|