diff --git a/lib/commands/generate/keys.js b/lib/commands/generate/keys.js index 091ff05d..ffa8c9e4 100644 --- a/lib/commands/generate/keys.js +++ b/lib/commands/generate/keys.js @@ -1,5 +1,5 @@ -import childProcess from "node:child_process"; import crypto from "node:crypto"; +import { copyToClipboard } from "#core/utils"; import Command from "#lib/command"; export default class extends Command { @@ -74,9 +74,7 @@ export default class extends Command { console.log( privateKey ); if ( process.cli.options.copy && process.platform === "win32" ) { - childProcess.spawnSync( "clip", { - "input": privateKey, - } ); + copyToClipboard( privateKey ); console.log( "Private key copied to the clipboard" ); } diff --git a/lib/commands/generate/telegram-session.js b/lib/commands/generate/telegram-session.js index 7e0007c6..eb429847 100644 --- a/lib/commands/generate/telegram-session.js +++ b/lib/commands/generate/telegram-session.js @@ -1,5 +1,5 @@ -import childProcess from "node:child_process"; import TelegramClient from "#core/api/telegram/client"; +import { copyToClipboard } from "#core/utils"; import Command from "#lib/command"; export default class extends Command { @@ -72,9 +72,7 @@ ${ session } ` ); if ( process.cli.options.copy && process.platform === "win32" ) { - childProcess.spawnSync( "clip", { - "input": session, - } ); + copyToClipboard( session ); console.log( "Session copied to the clipboard" ); }