Files
blog/tmp_inline.py
T
2026-06-01 17:57:22 +08:00

24 lines
785 B
Python

# Read helpers.go and append its functions to tgcore.go
helpers_path = r"E:\GitHub\blog\bot-go\internal\helpers\helpers.go"
tgcore_path = r"E:\GitHub\blog\bot-go\internal\tgcore\tgcore.go"
with open(helpers_path, "rb") as f:
helpers = f.read().decode("utf-8")
with open(tgcore_path, "rb") as f:
tgcore = f.read().decode("utf-8")
# Strip package declaration and imports from helpers
helpers = helpers.replace("package helpers\n", "")
# Remove import block
import_end = helpers.find(")\n")
if import_end > 0:
helpers = helpers[import_end+2:]
# Add helper functions to end of tgcore
tgcore = tgcore.rstrip() + "\n\n// === Inlined from helpers ===\n" + helpers
with open(tgcore_path, "wb") as f:
f.write(tgcore.encode("utf-8"))
print("helpers inlined into tgcore")