mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Add complete
mode to updateMessage
This commit is contained in:
parent
aa65cbf8a1
commit
b8fd2fb931
|
@ -412,6 +412,10 @@ var COMMANDS = {
|
||||||
for (var i = 0; i < activeMessages.length; i++) {
|
for (var i = 0; i < activeMessages.length; i++) {
|
||||||
var msg = activeMessages[i];
|
var msg = activeMessages[i];
|
||||||
if (msg.userid === args.userid && msg.customId === customId) {
|
if (msg.userid === args.userid && msg.customId === customId) {
|
||||||
|
if (mode === 'complete') {
|
||||||
|
activeMessages.splice(i, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
message = msg;
|
message = msg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@ import { isAdmin, isModerator } from "../utility/_UAC.js";
|
||||||
import { ACTIVE_MESSAGES, MAX_MESSAGE_ID_LENGTH } from "./chat.js";
|
import { ACTIVE_MESSAGES, MAX_MESSAGE_ID_LENGTH } from "./chat.js";
|
||||||
|
|
||||||
export async function run({ core, server, socket, payload }) {
|
export async function run({ core, server, socket, payload }) {
|
||||||
// undefined | "overwrite" | "append" | "prepend"
|
// undefined | "overwrite" | "append" | "prepend" | "complete"
|
||||||
let mode = payload.mode;
|
let mode = payload.mode;
|
||||||
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
mode = 'overwrite';
|
mode = 'overwrite';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode !== 'overwrite' && mode !== 'append' && mode !== 'prepend') {
|
if (mode !== 'overwrite' && mode !== 'append' && mode !== 'prepend' && mode !== 'complete') {
|
||||||
return server.police.frisk(socket.address, 13);
|
return server.police.frisk(socket.address, 13);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,5 +93,5 @@ export const info = {
|
||||||
category: 'core',
|
category: 'core',
|
||||||
description: 'Update a message you have sent.',
|
description: 'Update a message you have sent.',
|
||||||
usage: `
|
usage: `
|
||||||
API: { cmd: 'updateMessage', mode: 'overwrite'|'append'|'prepend', text: '<text to apply>', customId: '<customId sent with the chat message>' }`,
|
API: { cmd: 'updateMessage', mode: 'overwrite'|'append'|'prepend'|'complete', text: '<text to apply>', customId: '<customId sent with the chat message>' }`,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user