Merge pull request 'fix: use snowflake for message nonce' (#22) from plus024/Kettu:main into main

Reviewed-on: https://codeberg.org/cocobo1/Kettu/pulls/22
This commit is contained in:
cocobo1 2025-12-31 14:01:34 +01:00
commit 95a5b9e80c
3 changed files with 3 additions and 3 deletions

View file

@ -28,7 +28,7 @@ export default () => <ApplicationCommand>{
if (ephemeral?.value) {
messageUtil.sendBotMessage(ctx.channel.id, content);
} else {
const fixNonce = Date.now().toString();
const fixNonce = (BigInt(Date.now() - 1420070400000) << 22n).toString();
messageUtil.sendMessage(ctx.channel.id, { content }, void 0, {nonce:fixNonce});
}
}

View file

@ -36,7 +36,7 @@ export default () => <ApplicationCommand>{
if (ephemeral?.value) {
messageUtil.sendBotMessage(ctx.channel.id, content);
} else {
const fixNonce = Date.now().toString();
const fixNonce = (BigInt(Date.now() - 1420070400000) << 22n).toString();
messageUtil.sendMessage(ctx.channel.id, { content }, void 0, {nonce:fixNonce});
}
}

View file

@ -33,7 +33,7 @@ export default defineCorePlugin({
) {
// Ensure options exists and has a nonce
options = options || {};
options.nonce = options.nonce || Date.now().toString();
options.nonce = options.nonce || (BigInt(Date.now() - 1420070400000) << 22n).toString();
// Call original with fixed parameters
return originalSendMessage.call(