From 87a55bf43e61af57c6c88f1be57e2e0f2036d869 Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 26 Sep 2025 09:39:11 +0200 Subject: add local music playing --- main.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'main.py') diff --git a/main.py b/main.py index 708e04f..c038518 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ -import datetime import logging import os import sys +import json # create a pycord bot template import discord @@ -27,6 +27,26 @@ async def on_ready(): # send the message to channel ID channel = bot.get_channel(1081667823799111804) await channel.send("ƁUKASZ SPERMA AKTYWACJA") + if not os.path.exists('settings.json'): + with open('settings.json', 'w') as f: + json.dump({ + 'volume': 1.0, + 'audio_paths': ['audio', 'music', 'sounds'] + }, f) + if os.path.exists('settings.json'): + try: + with open('settings.json') as f: + data = json.load(f) + assert 'volume' in data and isinstance(data['volume'], float) + assert 'audio_paths' in data and isinstance(data['audio_paths'], list) + except (json.JSONDecodeError, AssertionError) as e: + logger.error(f"Error loading settings.json: {e}") + with open('settings.json', 'w') as f: + json.dump({ + 'volume': 1.0, + 'audio_paths': ['audio', 'music', 'sounds'] + }, f) + logger.info("settings.json created") if __name__ == "__main__": -- cgit v1.2.3