Skip to content

Commit

Permalink
Added breaks in start_radio to prevent pausing when invalid station n…
Browse files Browse the repository at this point in the history
…ame is sent.
  • Loading branch information
MAXimized490 authored Jan 23, 2025
1 parent b055218 commit 12642f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def start_radio(ctx, useDefaultVolume, station_name=None):
# If the name can't be found, let the user know.
else:
await ctx.send(f"Sorry, I've never heard of `{station_name}`.")
return
break
# If no station name was provided...
else:
# And the last_station exists and can be found in the "stations" list
Expand All @@ -79,6 +79,7 @@ async def start_radio(ctx, useDefaultVolume, station_name=None):
else:
# Let the user know. This might be indicative of no stations being set yet.
await ctx.send("Uh oh. You didn't specify a station and I can't recall the last station I played. This normally shouldn't happen, but just try specifying a station for me to play.")
break

# Start streaming the radio. Log if the remote stream ends (normally shouldn't happen).
vc.play(discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(stream_url), volume=actual_volume), after=lambda e: print(f"Stream ended: {e}"))
Expand Down

0 comments on commit 12642f8

Please sign in to comment.