aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/vclogs.py
diff options
context:
space:
mode:
authorSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 17:16:33 +0200
committerSamlon <stankiewiczgracjan2019@gmail.com>2025-08-11 17:16:33 +0200
commit0eb1a48fca5668c7c5c35ef81d247b4511d8e78a (patch)
tree1ac1ed8f62ac0d641b6527141afd6f06eb3f8ade /cogs/vclogs.py
parentfixing not working skip (diff)
downloadsenator-sperma-0eb1a48fca5668c7c5c35ef81d247b4511d8e78a.tar.gz
senator-sperma-0eb1a48fca5668c7c5c35ef81d247b4511d8e78a.zip
changed printing to proper logging
Diffstat (limited to '')
-rw-r--r--cogs/vclogs.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/cogs/vclogs.py b/cogs/vclogs.py
index 4bc7104..ed0737b 100644
--- a/cogs/vclogs.py
+++ b/cogs/vclogs.py
@@ -1,11 +1,14 @@
1import datetime 1import datetime
2import json 2import json
3import logging
3import os 4import os
4 5
5import discord 6import discord
6from discord.ext import commands 7from discord.ext import commands
7from gtts import gTTS 8from gtts import gTTS
8 9
10logger = logging.getLogger(__name__)
11
9 12
10class VcLogs(commands.Cog): 13class VcLogs(commands.Cog):
11 def __init__(self, bot): 14 def __init__(self, bot):
@@ -39,7 +42,7 @@ class VcLogs(commands.Cog):
39 42
40 message, tts_text = state_messages[state_type][is_enabled] 43 message, tts_text = state_messages[state_type][is_enabled]
41 await log_channel.send(message) 44 await log_channel.send(message)
42 print(message) 45 logger.info(f"Voice state change: {message}")
43 return tts_text, channel 46 return tts_text, channel
44 47
45 async def play_tts(self, channel, text): 48 async def play_tts(self, channel, text):
@@ -80,10 +83,10 @@ class VcLogs(commands.Cog):
80 json.dump({'volume': '5'}, f, indent=4) 83 json.dump({'volume': '5'}, f, indent=4)
81 with open('settings.json', 'w') as f: 84 with open('settings.json', 'w') as f:
82 json.dump({"volume": volume}, f, indent=4) 85 json.dump({"volume": volume}, f, indent=4)
83 await ctx.send(f"Volume has been set to: {volume}") 86 await ctx.followup.send(f"Volume has been set to: {volume}")
84 except Exception as e: 87 except Exception as e:
85 await ctx.respond(e, ephemeral=True) 88 await ctx.respond(e, ephemeral=True)
86 print(e) 89 logger.error(f"Error in volume command: {e}", exc_info=True)
87 90
88 @commands.Cog.listener() 91 @commands.Cog.listener()
89 async def on_voice_state_update(self, member, before, after): 92 async def on_voice_state_update(self, member, before, after):
@@ -101,13 +104,13 @@ class VcLogs(commands.Cog):
101 tts_text = f"{member.display_name} sie zespawnił" 104 tts_text = f"{member.display_name} sie zespawnił"
102 tts_channel = after.channel 105 tts_channel = after.channel
103 await log_channel.send(message) 106 await log_channel.send(message)
104 print(message) 107 logger.info(f"User joined voice channel: {message}")
105 elif before.channel is not None and after.channel is None: 108 elif before.channel is not None and after.channel is None:
106 message = f"[{current_time}] {member.name} rozłączył się z {before.channel.name}" 109 message = f"[{current_time}] {member.name} rozłączył się z {before.channel.name}"
107 tts_text = f"{member.display_name} jest chujem" 110 tts_text = f"{member.display_name} jest chujem"
108 tts_channel = before.channel 111 tts_channel = before.channel
109 await log_channel.send(message) 112 await log_channel.send(message)
110 print(message) 113 logger.info(f"User left voice channel: {message}")
111 114
112 if before.self_deaf != after.self_deaf: 115 if before.self_deaf != after.self_deaf:
113 tts_text, tts_channel = await self.handle_state_change( 116 tts_text, tts_channel = await self.handle_state_change(