diff options
| author | Samlon <stankiewiczgracjan2019@gmail.com> | 2025-08-13 14:59:22 +0200 |
|---|---|---|
| committer | Samlon <stankiewiczgracjan2019@gmail.com> | 2025-08-13 14:59:22 +0200 |
| commit | 8d0a52ab34563beab33be2dfb207da0e03a8fe32 (patch) | |
| tree | 6d670fe2985259c9c2a69ce80f1b8a0bd1d16d6c /cogs/music/play_compressed.py | |
| parent | prevent discord from complaining (diff) | |
| download | senator-sperma-8d0a52ab34563beab33be2dfb207da0e03a8fe32.tar.gz senator-sperma-8d0a52ab34563beab33be2dfb207da0e03a8fe32.zip | |
prevent discord from complaining and bot does not leave vc after playing
Diffstat (limited to '')
| -rw-r--r-- | cogs/music/play_compressed.py | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/cogs/music/play_compressed.py b/cogs/music/play_compressed.py index dd8dfd8..2bae269 100644 --- a/cogs/music/play_compressed.py +++ b/cogs/music/play_compressed.py | |||
| @@ -89,19 +89,10 @@ class GrajcujZkompresowane(commands.Cog): | |||
| 89 | found_file = compressed_file_path | 89 | found_file = compressed_file_path |
| 90 | found_title = title | 90 | found_title = title |
| 91 | title = found_title | 91 | title = found_title |
| 92 | def after_playing(error): | ||
| 93 | if error: | ||
| 94 | logger.error(f'Player error: {error}') | ||
| 95 | coro = vc.disconnect() | ||
| 96 | fut = asyncio.run_coroutine_threadsafe(coro, self.bot.loop) | ||
| 97 | try: | ||
| 98 | fut.result() | ||
| 99 | except Exception as e: | ||
| 100 | logger.error(f'Error disconnecting: {e}', exc_info=True) | ||
| 101 | 92 | ||
| 102 | if vc.is_playing() or vc.is_paused(): | 93 | if vc.is_playing() or vc.is_paused(): |
| 103 | vc.stop() | 94 | vc.stop() |
| 104 | vc.play(discord.FFmpegPCMAudio(found_file), after=after_playing) | 95 | vc.play(discord.FFmpegPCMAudio(found_file)) |
| 105 | await ctx.followup.send(f"gra (zkompresowane): {title}") | 96 | await ctx.followup.send(f"gra (zkompresowane): {title}") |
| 106 | logger.info(f"Playing audio: {title}") | 97 | logger.info(f"Playing audio: {title}") |
| 107 | 98 | ||
