playpause

This commit is contained in:
AF 2023-10-06 02:23:27 +00:00
parent c085feea71
commit 86aa68845f

View File

@ -351,16 +351,34 @@ presets: {shlex.join(allowed_presets)}
case _:
raise Explicit("misformatted")
@at("||")
@at("")
@at("⏸️")
@at("pause")
async def pause(ctx: Context, _args: list[str]) -> None:
vc = await mainservice.context(ctx, create=False, force_play=False).vc()
vc.pause()
@at("|>")
@at(">")
@at("")
@at("resume")
async def resume(ctx: Context, _args: list[str]) -> None:
vc = await mainservice.context(ctx, create=False, force_play=True).vc()
vc.resume()
@at(".")
@at("")
@at("⏯️")
@at("pp")
@at("playpause")
async def playpause(ctx: Context, _args: list[str]) -> None:
vc = await mainservice.context(ctx, create=False, force_play=True).vc()
if vc.is_paused():
vc.resume()
else:
vc.pause()
@at("leave")
async def leave(ctx: Context, _args: list[str]) -> None:
async with mainservice.lock_for(ctx.guild):