mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Added event channel
This commit is contained in:
parent
6a1a9df096
commit
866fa9bcff
@ -368,6 +368,11 @@ var COMMANDS = {
|
|||||||
info: function (args) {
|
info: function (args) {
|
||||||
args.nick = '*';
|
args.nick = '*';
|
||||||
pushMessage(args);
|
pushMessage(args);
|
||||||
|
},
|
||||||
|
|
||||||
|
emote: function (args) {
|
||||||
|
args.nick = '*';
|
||||||
|
pushMessage(args);
|
||||||
},
|
},
|
||||||
|
|
||||||
warn: function (args) {
|
warn: function (args) {
|
||||||
|
@ -28,6 +28,7 @@ export async function run({
|
|||||||
server.send({
|
server.send({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: 'You are now a mod.',
|
text: 'You are now a mod.',
|
||||||
|
channel: newMod[i].channel, // @todo Multichannel
|
||||||
}, newMod[i]);
|
}, newMod[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,12 +37,14 @@ export async function run({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Added mod trip: ${payload.trip}, remember to run 'saveconfig' to make it permanent`,
|
text: `Added mod trip: ${payload.trip}, remember to run 'saveconfig' to make it permanent`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// notify all mods
|
// notify all mods
|
||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Added mod: ${payload.trip}`,
|
text: `Added mod: ${payload.trip}`,
|
||||||
|
channel: false, // @todo Multichannel, false for global info
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -42,6 +42,7 @@ export async function run({ server, socket }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: lines.join('\n'),
|
text: lines.join('\n'),
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,6 +36,7 @@ export async function run({
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: loadResult,
|
text: loadResult,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -29,6 +29,7 @@ export async function run({
|
|||||||
server.send({
|
server.send({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: 'You are now a user.',
|
text: 'You are now a user.',
|
||||||
|
channel: targetMod[i].channel, // @todo Multichannel
|
||||||
}, targetMod[i]);
|
}, targetMod[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,12 +40,14 @@ export async function run({
|
|||||||
text: `Removed mod trip: ${
|
text: `Removed mod trip: ${
|
||||||
payload.trip
|
payload.trip
|
||||||
}, remember to run 'saveconfig' to make it permanent`,
|
}, remember to run 'saveconfig' to make it permanent`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// notify all mods
|
// notify all mods
|
||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Removed mod: ${payload.trip}`,
|
text: `Removed mod: ${payload.trip}`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -16,6 +16,7 @@ export async function run({ core, server, socket }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Failed to save config, check logs.',
|
text: 'Failed to save config, check logs.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ export async function run({ core, server, socket }) {
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: 'Config saved!',
|
text: 'Config saved!',
|
||||||
|
channel: false, // @todo Multichannel
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -15,6 +15,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Server Notice: ${payload.text}`,
|
text: `Server Notice: ${payload.text}`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -14,6 +14,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are changing nicknames too fast. Wait a moment before trying again.',
|
text: 'You are changing nicknames too fast. Wait a moment before trying again.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Nickname must consist of up to 24 letters, numbers, and underscores',
|
text: 'Nickname must consist of up to 24 letters, numbers, and underscores',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +43,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are not the admin, liar!',
|
text: 'You are not the admin, liar!',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +51,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You already have that name',
|
text: 'You already have that name',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +69,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Nickname taken',
|
text: 'Nickname taken',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +79,7 @@ export async function run({
|
|||||||
const leaveNotice = {
|
const leaveNotice = {
|
||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
nick: socket.nick,
|
nick: socket.nick,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
};
|
};
|
||||||
|
|
||||||
const joinNotice = {
|
const joinNotice = {
|
||||||
@ -81,6 +87,7 @@ export async function run({
|
|||||||
nick: newNick,
|
nick: newNick,
|
||||||
trip: socket.trip || 'null',
|
trip: socket.trip || 'null',
|
||||||
hash: socket.hash,
|
hash: socket.hash,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
};
|
};
|
||||||
|
|
||||||
// broadcast remove event and join event with new name, this is to support legacy clients and bots
|
// broadcast remove event and join event with new name, this is to support legacy clients and bots
|
||||||
@ -91,6 +98,7 @@ export async function run({
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick} is now ${newNick}`,
|
text: `${socket.nick} is now ${newNick}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: socket.channel });
|
}, { channel: socket.channel });
|
||||||
|
|
||||||
// commit change to nickname
|
// commit change to nickname
|
||||||
@ -120,6 +128,7 @@ export function nickCheck({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Refer to `/help nick` for instructions on how to use this command.',
|
text: 'Refer to `/help nick` for instructions on how to use this command.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -39,6 +39,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ export function commandCheckIn({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Your hash: ${socket.hash}`,
|
text: `Your hash: ${socket.hash}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -114,6 +116,7 @@ export function finalCmdCheck({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: `Unknown command: ${payload.text}`,
|
text: `Unknown command: ${payload.text}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -35,6 +35,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
nick: socket.nick,
|
nick: socket.nick,
|
||||||
userid: socket.userid,
|
userid: socket.userid,
|
||||||
text: `@${socket.nick}${text}`,
|
text: `@${socket.nick}${text}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
};
|
};
|
||||||
|
|
||||||
if (socket.trip) {
|
if (socket.trip) {
|
||||||
@ -80,6 +82,7 @@ export function emoteCheck({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Refer to `/help emote` for instructions on how to use this command.',
|
text: 'Refer to `/help emote` for instructions on how to use this command.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,6 +11,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ export async function run({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: reply,
|
text: reply,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,6 +36,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'You are sending invites too fast. Wait a moment before trying again.',
|
text: 'You are sending invites too fast. Wait a moment before trying again.',
|
||||||
id: Errors.Invite.RATELIMIT,
|
id: Errors.Invite.RATELIMIT,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Could not find user in that channel',
|
text: 'Could not find user in that channel',
|
||||||
id: Errors.Global.UNKNOWN_USER,
|
id: Errors.Global.UNKNOWN_USER,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'You are joining channels too fast. Wait a moment and try again.',
|
text: 'You are joining channels too fast. Wait a moment and try again.',
|
||||||
id: Errors.Join.RATELIMIT,
|
id: Errors.Join.RATELIMIT,
|
||||||
|
channel: false, // @todo Multichannel, false for global event
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'You may not join that channel.',
|
text: 'You may not join that channel.',
|
||||||
id: mayJoin,
|
id: mayJoin,
|
||||||
|
channel: false, // @todo Multichannel, false for global event
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ export async function run({
|
|||||||
cmd: 'warn', // @todo Remove this
|
cmd: 'warn', // @todo Remove this
|
||||||
text: 'Joining more than one channel is not currently supported',
|
text: 'Joining more than one channel is not currently supported',
|
||||||
id: Errors.Join.ALREADY_JOINED,
|
id: Errors.Join.ALREADY_JOINED,
|
||||||
|
channel: false, // @todo Multichannel, false for global event
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
// end todo
|
// end todo
|
||||||
@ -68,6 +71,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Nickname must consist of up to 24 letters, numbers, and underscores',
|
text: 'Nickname must consist of up to 24 letters, numbers, and underscores',
|
||||||
id: Errors.Join.INVALID_NICK,
|
id: Errors.Join.INVALID_NICK,
|
||||||
|
channel: false, // @todo Multichannel, false for global event
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +107,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Nickname taken',
|
text: 'Nickname taken',
|
||||||
id: Errors.Join.NAME_TAKEN,
|
id: Errors.Join.NAME_TAKEN,
|
||||||
|
channel: false, // @todo Multichannel, false for global event
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +151,7 @@ export async function run({
|
|||||||
cmd: 'onlineSet',
|
cmd: 'onlineSet',
|
||||||
nicks, /* @legacy */
|
nicks, /* @legacy */
|
||||||
users,
|
users,
|
||||||
|
channel, // @todo Multichannel (?)
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// stats are fun
|
// stats are fun
|
||||||
|
@ -51,6 +51,7 @@ export async function run({ core, server, socket }) {
|
|||||||
users-kicked: ${(core.stats.get('users-kicked') || 0)}
|
users-kicked: ${(core.stats.get('users-kicked') || 0)}
|
||||||
stats-requested: ${(core.stats.get('stats-requested') || 0)}
|
stats-requested: ${(core.stats.get('stats-requested') || 0)}
|
||||||
server-uptime: ${formatTime(process.hrtime(core.stats.get('start-time')))}`,
|
server-uptime: ${formatTime(process.hrtime(core.stats.get('start-time')))}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// stats are fun
|
// stats are fun
|
||||||
|
@ -10,6 +10,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are changing channels too fast. Wait a moment before trying again.',
|
text: 'You are changing channels too fast. Wait a moment before trying again.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Cannot move to an empty channel.',
|
text: 'Cannot move to an empty channel.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,12 +52,14 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
nick: peerList[i].nick,
|
nick: peerList[i].nick,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
if (socket.nick !== peerList[i].nick) {
|
if (socket.nick !== peerList[i].nick) {
|
||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
nick: socket.nick,
|
nick: socket.nick,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, peerList[i]);
|
}, peerList[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,6 +87,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'onlineSet',
|
cmd: 'onlineSet',
|
||||||
nicks,
|
nicks,
|
||||||
|
channel: socket.channel, // @todo Multichannel (!)
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// commit change
|
// commit change
|
||||||
@ -111,6 +116,7 @@ export function moveCheck({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Refer to `/help move` for instructions on how to use this command.',
|
text: 'Refer to `/help move` for instructions on how to use this command.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,6 +25,7 @@ export async function run({ core, server, socket }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels`,
|
text: `${uniqueClientCount} unique IPs in ${uniqueChannels} channels`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// stats are fun
|
// stats are fun
|
||||||
|
@ -40,6 +40,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Could not find user in channel',
|
text: 'Could not find user in channel',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +68,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
from: socket.nick,
|
from: socket.nick,
|
||||||
trip: socket.trip || 'null',
|
trip: socket.trip || 'null',
|
||||||
text: `${socket.nick} whispered: ${text}`,
|
text: `${socket.nick} whispered: ${text}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, targetClient);
|
}, targetClient);
|
||||||
|
|
||||||
targetClient.whisperReply = socket.nick;
|
targetClient.whisperReply = socket.nick;
|
||||||
@ -74,6 +77,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
type: 'whisper',
|
type: 'whisper',
|
||||||
text: `You whispered to @${targetNick}: ${text}`,
|
text: `You whispered to @${targetNick}: ${text}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -100,6 +104,7 @@ export function whisperCheck({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Refer to `/help whisper` for instructions on how to use this command.',
|
text: 'Refer to `/help whisper` for instructions on how to use this command.',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -128,6 +133,7 @@ export function whisperCheck({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Cannot reply to nobody',
|
text: 'Cannot reply to nobody',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -16,6 +16,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
userid: socket.userid,
|
userid: socket.userid,
|
||||||
nick: socket.nick, /* @legacy */
|
nick: socket.nick, /* @legacy */
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: socket.channel });
|
}, { channel: socket.channel });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: payload.text,
|
text: payload.text,
|
||||||
|
channel: socket.channel || false, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -38,6 +38,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Could not find user in that channel',
|
text: 'Could not find user in that channel',
|
||||||
id: Errors.Global.UNKNOWN_USER,
|
id: Errors.Global.UNKNOWN_USER,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
const targetNick = targetUser.nick;
|
const targetNick = targetUser.nick;
|
||||||
@ -48,6 +49,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Cannot ban other users of the same level, how rude',
|
text: 'Cannot ban other users of the same level, how rude',
|
||||||
id: Errors.Global.PERMISSION,
|
id: Errors.Global.PERMISSION,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +63,15 @@ export async function run({
|
|||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Banned ${targetNick}`,
|
text: `Banned ${targetNick}`,
|
||||||
user: UAC.getUserDetails(targetUser),
|
user: UAC.getUserDetails(targetUser),
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: socket.channel, level: (level) => level < UAC.levels.moderator });
|
}, { channel: socket.channel, level: (level) => level < UAC.levels.moderator });
|
||||||
|
|
||||||
// notify mods
|
// notify mods
|
||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick}#${socket.trip} banned ${targetNick} in ${payload.channel}, userhash: ${targetUser.hash}`,
|
text: `${socket.nick}#${socket.trip} banned ${targetNick} in ${payload.channel}, userhash: ${targetUser.hash}`,
|
||||||
channel: payload.channel,
|
channel: socket.channel, // @todo Multichannel
|
||||||
|
inChannel: payload.channel,
|
||||||
user: UAC.getUserDetails(targetUser),
|
user: UAC.getUserDetails(targetUser),
|
||||||
banner: UAC.getUserDetails(socket),
|
banner: UAC.getUserDetails(socket),
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
@ -48,6 +48,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Could not find user in that channel',
|
text: 'Could not find user in that channel',
|
||||||
id: Errors.Global.UNKNOWN_USER,
|
id: Errors.Global.UNKNOWN_USER,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'This trick wont work on users of the same level',
|
text: 'This trick wont work on users of the same level',
|
||||||
id: Errors.Global.PERMISSION,
|
id: Errors.Global.PERMISSION,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +76,7 @@ export async function run({
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick}#${socket.trip} muzzled ${targetUser.nick} in ${payload.channel}, userhash: ${targetUser.hash}`,
|
text: `${socket.nick}#${socket.trip} muzzled ${targetUser.nick} in ${payload.channel}, userhash: ${targetUser.hash}`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -100,6 +103,7 @@ export function chatCheck({
|
|||||||
cmd: 'chat',
|
cmd: 'chat',
|
||||||
nick: socket.nick,
|
nick: socket.nick,
|
||||||
text: payload.text,
|
text: payload.text,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
};
|
};
|
||||||
|
|
||||||
if (socket.trip) {
|
if (socket.trip) {
|
||||||
@ -142,6 +146,7 @@ export function inviteCheck({ core, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: nickValid,
|
text: nickValid,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -177,6 +182,7 @@ export function whisperCheck({
|
|||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
type: 'whisper',
|
type: 'whisper',
|
||||||
text: `You whispered to @${targetNick}: ${payload.text}`,
|
text: `You whispered to @${targetNick}: ${payload.text}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// blanket "spam" protection, may expose the ratelimiting lines from
|
// blanket "spam" protection, may expose the ratelimiting lines from
|
||||||
|
@ -44,6 +44,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Could not find user(s) in that channel',
|
text: 'Could not find user(s) in that channel',
|
||||||
id: Errors.Global.UNKNOWN_USER,
|
id: Errors.Global.UNKNOWN_USER,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ export async function run({
|
|||||||
cmd: 'warn',
|
cmd: 'warn',
|
||||||
text: 'Cannot kick other users with the same level, how rude',
|
text: 'Cannot kick other users with the same level, how rude',
|
||||||
id: Errors.Global.PERMISSION,
|
id: Errors.Global.PERMISSION,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
} else {
|
} else {
|
||||||
kicked.push(badClients[i]);
|
kicked.push(badClients[i]);
|
||||||
@ -95,6 +97,7 @@ export async function run({
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${kicked[i].nick} was banished to ?${destChannel}`,
|
text: `${kicked[i].nick} was banished to ?${destChannel}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: socket.channel, level: UAC.isModerator });
|
}, { channel: socket.channel, level: UAC.isModerator });
|
||||||
|
|
||||||
console.log(`${socket.nick} [${socket.trip}] kicked ${kicked[i].nick} in ${socket.channel} to ${destChannel} `);
|
console.log(`${socket.nick} [${socket.trip}] kicked ${kicked[i].nick} in ${socket.channel} to ${destChannel} `);
|
||||||
@ -106,6 +109,7 @@ export async function run({
|
|||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
userid: kicked[i].userid,
|
userid: kicked[i].userid,
|
||||||
nick: kicked[i].nick,
|
nick: kicked[i].nick,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: socket.channel });
|
}, { channel: socket.channel });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +117,7 @@ export async function run({
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Kicked ${kicked.map((k) => k.nick).join(', ')}`,
|
text: `Kicked ${kicked.map((k) => k.nick).join(', ')}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: socket.channel, level: (level) => level < UAC.levels.moderator });
|
}, { channel: socket.channel, level: (level) => level < UAC.levels.moderator });
|
||||||
|
|
||||||
// stats are fun
|
// stats are fun
|
||||||
|
@ -28,6 +28,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Could not find user in channel',
|
text: 'Could not find user in channel',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: 'Cannot move other users of the same level, how rude',
|
text: 'Cannot move other users of the same level, how rude',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,12 +60,14 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
nick: peerList[i].nick,
|
nick: peerList[i].nick,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, badClient);
|
}, badClient);
|
||||||
|
|
||||||
if (badClient.nick !== peerList[i].nick) {
|
if (badClient.nick !== peerList[i].nick) {
|
||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'onlineRemove',
|
cmd: 'onlineRemove',
|
||||||
nick: badClient.nick,
|
nick: badClient.nick,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, peerList[i]);
|
}, peerList[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,6 +93,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'onlineSet',
|
cmd: 'onlineSet',
|
||||||
nicks,
|
nicks,
|
||||||
|
channel: socket.channel, // @todo Multichannel (!)
|
||||||
}, badClient);
|
}, badClient);
|
||||||
|
|
||||||
badClient.channel = payload.channel;
|
badClient.channel = payload.channel;
|
||||||
@ -96,6 +101,7 @@ export async function run({ server, socket, payload }) {
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${badClient.nick} was moved into ?${payload.channel}`,
|
text: `${badClient.nick} was moved into ?${payload.channel}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, { channel: payload.channel });
|
}, { channel: payload.channel });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -28,6 +28,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: "hash:'targethash' or ip:'1.2.3.4' is required",
|
text: "hash:'targethash' or ip:'1.2.3.4' is required",
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ export async function run({
|
|||||||
return server.broadcast({
|
return server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick} unmuzzled all users`,
|
text: `${socket.nick} unmuzzled all users`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
}
|
}
|
||||||
} else if (payload.hash === '*') {
|
} else if (payload.hash === '*') {
|
||||||
@ -46,6 +48,7 @@ export async function run({
|
|||||||
return server.broadcast({
|
return server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick} unmuzzled all users`,
|
text: `${socket.nick} unmuzzled all users`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +66,7 @@ export async function run({
|
|||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick}#${socket.trip} unmuzzled : ${target}`,
|
text: `${socket.nick}#${socket.trip} unmuzzled : ${target}`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,6 +20,7 @@ export async function run({
|
|||||||
return server.reply({
|
return server.reply({
|
||||||
cmd: 'warn', // @todo Add numeric error code as `id`
|
cmd: 'warn', // @todo Add numeric error code as `id`
|
||||||
text: "hash:'targethash' or ip:'1.2.3.4' is required",
|
text: "hash:'targethash' or ip:'1.2.3.4' is required",
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,12 +48,14 @@ export async function run({
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `Unbanned ${target}`,
|
text: `Unbanned ${target}`,
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// notify mods
|
// notify mods
|
||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick}#${socket.trip} unbanned: ${target}`,
|
text: `${socket.nick}#${socket.trip} unbanned: ${target}`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
// stats are fun
|
// stats are fun
|
||||||
|
@ -24,12 +24,14 @@ export async function run({ core, server, socket }) {
|
|||||||
server.reply({
|
server.reply({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: 'Unbanned all ip addresses',
|
text: 'Unbanned all ip addresses',
|
||||||
|
channel: socket.channel, // @todo Multichannel
|
||||||
}, socket);
|
}, socket);
|
||||||
|
|
||||||
// notify mods
|
// notify mods
|
||||||
server.broadcast({
|
server.broadcast({
|
||||||
cmd: 'info',
|
cmd: 'info',
|
||||||
text: `${socket.nick}#${socket.trip} unbanned all ip addresses`,
|
text: `${socket.nick}#${socket.trip} unbanned all ip addresses`,
|
||||||
|
channel: false, // @todo Multichannel, false for global
|
||||||
}, { level: UAC.isModerator });
|
}, { level: UAC.isModerator });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -67,6 +67,7 @@ export function legacyInviteOut(payload, nick) {
|
|||||||
type: 'invite',
|
type: 'invite',
|
||||||
from: nick,
|
from: nick,
|
||||||
text: `${nick} invited you to ?${payload.inviteChannel}`,
|
text: `${nick} invited you to ?${payload.inviteChannel}`,
|
||||||
|
channel: payload.channel, // @todo Multichannel
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -85,6 +86,7 @@ export function legacyInviteReply(payload, nick) {
|
|||||||
type: 'invite',
|
type: 'invite',
|
||||||
from: '',
|
from: '',
|
||||||
text: `You invited ${nick} to ?${payload.inviteChannel}`,
|
text: `You invited ${nick} to ?${payload.inviteChannel}`,
|
||||||
|
channel: payload.channel, // @todo Multichannel
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user