Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/beak2825_chatlogger-template-1.21.4.json
T

1 line
4.9 KiB
JSON

{"repo": "beak2825/chatlogger-template-1.21.4", "files": {"gradle.properties": {"d393847b7751d5553c13a8d43eee2ca18cbf6d5f": {"t": 1785604247.2413998, "n": 580, "h": "00292f9ab55dfb34", "c": "# Done to increase the memory available to gradle.\norg.gradle.jvmargs=-Xmx1G\norg.gradle.parallel=true\n\n# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349\norg.gradle.configuration-cache=false\n\n# Fabric Properties\n# check these on https://fabricmc.net/develop\nminecraft_version=1.21.4\nyarn_mappings=1.21.4+build.8\nloader_version=0.18.3\nloom_version=1.14-SNAPSHOT\n\n# Mod Properties\nmod_version=1.0.0\nmaven_group=beak2825.chatlogger\narchives_base_name=chatlogger\n\n# Dependencies\nfabric_version=0.119.4+1.21.4"}}, "send_chat_to_discord.py": {"e0f9c874bb0304e99c2c482580f128d45b504950": {"t": 1785604248.4425051, "n": 3659, "h": "514d5782378f39d5", "c": "import os\nimport time\nimport requests\nimport threading\n\nCONFIG_FILE = 'config.txt'\nDEFAULT_CONFIG = '''link = \"https://discord.com/api/webhooks/id/xxxxxxxxxxx\"\n#REPLACE WITH YOUR WEBHOOK LINK\nmcpath = \"C:\\\\Users\\\\admin\\\\Desktop\\\\MultiMC\\\\instances\\\\1.21.4\\\\.minecraft\"\n#REPLACE WITH YOUR MC PATH TO YOUR FABRIC INSTANCE\ncooldown_sec = 1.5\n#REPLACE WITH YOUR PREFERRED COOLDOWN\n'''\n\ndef load_config():\n if not os.path.exists(CONFIG_FILE):\n with open(CONFIG_FILE, 'w', encoding='utf-8') as f:\n f.write(DEFAULT_CONFIG)\n print(f\"Please edit {CONFIG_FILE} with your settings.\")\n # Open config.txt automatically\n try:\n if os.name == 'nt':\n os.startfile(CONFIG_FILE)\n elif os.name == 'posix':\n os.system(f'xdg-open {CONFIG_FILE}')\n except Exception:\n pass\n exit(1)\n config = {}\n with open(CONFIG_FILE, 'r', encoding='utf-8') as f:\n for line in f:\n if '=' in line and not line.strip().startswith('#'):\n k, v = line.split('=', 1)\n config[k.strip()] = v.strip().strip('\"')\n return config\n\ndef check_webhook(link):\n try:\n r = requests.get(link)\n return r.status_code == 200\n except Exception:\n return False\n\ndef check_mcpath(mcpath):\n return os.path.exists(os.path.join(mcpath, 'chatlogs.txt'))\n\ndef send_discord(link, content):\n data = {\"content\": content}\n try:\n r = requests.post(link, json=data)\n return r.status_code == 204 or r.status_code == 200\n except Exception:\n return False\n\ndef format_message(line):\n if ' > ' in line:\n username, text = line.split(' > ', 1)\n return f\"**{username.strip()}** > `{text.strip()}`\"\n elif 'joined from' in line or 'left the game' in line:\n return f\"**[SERVER]** > {line.strip()}\"\n return None\n\ndef tail_file(path, callback, cooldown):\n sent = set()\n with open(path, 'r', encoding='utf-8') as f:\n lines = f.readlines()\n # Only send the last 15 lines on startup\n recent = lines[-15:] if len(lines) > 15 else lines\n for line in recent:\n line = line.strip()\n if not line or line in sent:\n continue\n msg = format_message(line)\n if msg:\n callback(msg)\n sent.add(line)\n time.sleep(cooldown)\n # Now tail for new lines\n while True:\n line = f.readline()\n if not line:\n time.sleep(0.1)\n continue\n line = line.strip()\n if not line or line in sent:\n continue\n msg = format_message(line)\n if msg:\n callback(msg)\n sent.add(line)\n time.sleep(cooldown)\n\ndef main():\n config = load_config()\n link = config.get('link')\n mcpath = config.get('mcpath')\n cooldown = float(config.get('cooldown_sec', 1.5))\n if not link or not mcpath:\n print('Missing link or mcpath in config.txt. Please check your config.')\n exit(1)\n chatlog_path = os.path.join(str(mcpath), 'chatlogs.txt')\n\n if not check_webhook(link):\n print('Invalid Discord webhook. Please check your config.txt.')\n exit(1)\n if not check_mcpath(mcpath):\n print('Invalid Minecraft path or chatlogs.txt not found. Please check your config.txt.')\n exit(1)\n print('Monitoring chatlogs.txt...')\n def send(msg):\n print('Sending:', msg)\n send_discord(link, msg)\n tail_file(chatlog_path, send, cooldown)\n\nif __name__ == '__main__':\n main()\n"}}, "settings.gradle": {"75c4d726aca9033faf6b7c735ccff846d5d362ef": {"t": 1785604249.9865003, "n": 151, "h": "8af15c9c513317c2", "c": "pluginManagement {\n\trepositories {\n\t\tmaven {\n\t\t\tname = 'Fabric'\n\t\t\turl = 'https://maven.fabricmc.net/'\n\t\t}\n\t\tmavenCentral()\n\t\tgradlePluginPortal()\n\t}\n}"}}}}