LD-FDPI/site/add_fdpi_command.py
2026-11-23 03:45:09 +03:00

35 lines
1.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from pathlib import Path
import shutil
p = Path('/opt/kick-duel/server.js')
t = p.read_text(encoding='utf-8')
if "handleFdpi" in t:
print('FDPI command already present')
raise SystemExit(0)
needle = " handleWebsite (name) {"
handler = ''' handleFdpi (name) {
const message = `⚡ @${name}, LD FDPI: Windows ve Linux için hız kayıpsız SpoofDPI DPI bypass, Smart DoH ve 7/24 Proxy Sentinel koruması. https://ttmadethat.shop/ld-fdpi`;
if (this.bot && typeof this.bot.queue === 'function') {
this.bot.queue(message).catch((err) => log('FDPI mesaji hatasi:', err.message));
} else {
this.notice(message, 'fdpi');
}
log(`FDPI linki gonderildi: ${name}`);
return true;
}
'''
if needle not in t:
raise SystemExit('handleWebsite anchor not found')
t = t.replace(needle, handler + needle, 1)
branch_needle = " if (command === 'website') {\n this.handleWebsite(name);\n return;\n }\n"
branch = branch_needle + "\n if (command === 'fdpi' || command === 'ldfdpi') {\n this.handleFdpi(name);\n return;\n }\n"
if branch_needle not in t:
raise SystemExit('website branch not found')
t = t.replace(branch_needle, branch, 1)
shutil.copy2(p, '/opt/kick-duel/server.js.bak-fdpi-command')
p.write_text(t, encoding='utf-8')
print('FDPI command added')