diff options
| author | salmonik <raisersoft@proton.me> | 2026-02-20 18:35:36 +0100 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-02-20 18:35:36 +0100 |
| commit | 1017fb648b1114106abe596663d26aa23fe12805 (patch) | |
| tree | 7f56e2b0aac9d19714985bf835aa7d1f90cf4428 /cogs | |
| parent | more asynchronous work and other minor improvements (diff) | |
| download | senator-sperma-1017fb648b1114106abe596663d26aa23fe12805.tar.gz senator-sperma-1017fb648b1114106abe596663d26aa23fe12805.zip | |
fix settings file nagging
Diffstat (limited to '')
| -rw-r--r-- | cogs/vclogs.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cogs/vclogs.py b/cogs/vclogs.py index bc317a4..0d8ca3b 100644 --- a/cogs/vclogs.py +++ b/cogs/vclogs.py | |||
| @@ -25,8 +25,8 @@ class VcLogs(commands.Cog): | |||
| 25 | 25 | ||
| 26 | @staticmethod | 26 | @staticmethod |
| 27 | def settings_check(): | 27 | def settings_check(): |
| 28 | if not os.path.exists(settings_file): | 28 | if not os.path.exists(VcLogs.settings_file): |
| 29 | with open(settings_file, 'w') as f: | 29 | with open(VcLogs.settings_file, 'w') as f: |
| 30 | json.dump({'volume': '5'}, f, indent=4) | 30 | json.dump({'volume': '5'}, f, indent=4) |
| 31 | logger.info("settings.json created") | 31 | logger.info("settings.json created") |
| 32 | 32 | ||
| @@ -67,8 +67,8 @@ class VcLogs(commands.Cog): | |||
| 67 | tts = gTTS(text=text, lang='pl') | 67 | tts = gTTS(text=text, lang='pl') |
| 68 | tts.save(tts_file) | 68 | tts.save(tts_file) |
| 69 | 69 | ||
| 70 | if os.path.exists(settings_file): | 70 | if os.path.exists(VcLogs.settings_file): |
| 71 | async with aiofiles.open(settings_file) as f: | 71 | async with aiofiles.open(VcLogs.settings_file) as f: |
| 72 | data = json.load(f) | 72 | data = json.load(f) |
| 73 | volume = data['volume'] | 73 | volume = data['volume'] |
| 74 | else: | 74 | else: |
| @@ -95,11 +95,11 @@ class VcLogs(commands.Cog): | |||
| 95 | ) | 95 | ) |
| 96 | async def volume(self, ctx: discord.ApplicationContext, volume: int): | 96 | async def volume(self, ctx: discord.ApplicationContext, volume: int): |
| 97 | try: | 97 | try: |
| 98 | if not os.path.exists(settings_file): | 98 | if not os.path.exists(VcLogs.settings_file): |
| 99 | async with aiofiles.open(settings_file, 'w') as f: | 99 | async with aiofiles.open(VcLogs.settings_file, 'w') as f: |
| 100 | json.dump({'volume': '5'}, f, indent=4) | 100 | json.dump({'volume': '5'}, f, indent=4) |
| 101 | logger.info("settings.json created") | 101 | logger.info("settings.json created") |
| 102 | async with aiofiles.open(settings_file, 'w') as f: | 102 | async with aiofiles.open(VcLogs.settings_file, 'w') as f: |
| 103 | json.dump({"volume": volume}, f, indent=4) | 103 | json.dump({"volume": volume}, f, indent=4) |
| 104 | await ctx.followup.send(f"Volume has been set to: {volume}") | 104 | await ctx.followup.send(f"Volume has been set to: {volume}") |
| 105 | logger.info(f"Volume changed to: {volume}") | 105 | logger.info(f"Volume changed to: {volume}") |
