aboutsummaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2025-09-26 09:39:11 +0200
committersalmonik <raisersoft@proton.me>2025-09-26 09:39:11 +0200
commit87a55bf43e61af57c6c88f1be57e2e0f2036d869 (patch)
treea8eee32d1f94ca1c5c40bcd4b9b570eeb4bb0f79 /main.py
parentadd requirements.txt (diff)
downloadsenator-sperma-87a55bf43e61af57c6c88f1be57e2e0f2036d869.tar.gz
senator-sperma-87a55bf43e61af57c6c88f1be57e2e0f2036d869.zip
add local music playing
Diffstat (limited to '')
-rw-r--r--main.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/main.py b/main.py
index 708e04f..c038518 100644
--- a/main.py
+++ b/main.py
@@ -1,7 +1,7 @@
1import datetime
2import logging 1import logging
3import os 2import os
4import sys 3import sys
4import json
5 5
6# create a pycord bot template 6# create a pycord bot template
7import discord 7import discord
@@ -27,6 +27,26 @@ async def on_ready():
27 # send the message to channel ID 27 # send the message to channel ID
28 channel = bot.get_channel(1081667823799111804) 28 channel = bot.get_channel(1081667823799111804)
29 await channel.send("ŁUKASZ SPERMA AKTYWACJA") 29 await channel.send("ŁUKASZ SPERMA AKTYWACJA")
30 if not os.path.exists('settings.json'):
31 with open('settings.json', 'w') as f:
32 json.dump({
33 'volume': 1.0,
34 'audio_paths': ['audio', 'music', 'sounds']
35 }, f)
36 if os.path.exists('settings.json'):
37 try:
38 with open('settings.json') as f:
39 data = json.load(f)
40 assert 'volume' in data and isinstance(data['volume'], float)
41 assert 'audio_paths' in data and isinstance(data['audio_paths'], list)
42 except (json.JSONDecodeError, AssertionError) as e:
43 logger.error(f"Error loading settings.json: {e}")
44 with open('settings.json', 'w') as f:
45 json.dump({
46 'volume': 1.0,
47 'audio_paths': ['audio', 'music', 'sounds']
48 }, f)
49 logger.info("settings.json created")
30 50
31 51
32if __name__ == "__main__": 52if __name__ == "__main__":