1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00
royalnet/royalpack/commands/pause.py

28 lines
948 B
Python
Raw Normal View History

2019-11-11 08:56:08 +00:00
import discord
2019-12-03 00:57:21 +00:00
from typing import *
2019-11-11 08:56:08 +00:00
from royalnet.commands import *
class PauseCommand(Command):
name: str = "pause"
2019-12-03 00:57:21 +00:00
aliases = ["resume"]
2019-11-11 08:56:08 +00:00
2019-12-03 00:57:21 +00:00
description: str = "Metti in pausa o riprendi la riproduzione di un file."
2019-11-11 08:56:08 +00:00
2019-12-03 00:57:21 +00:00
async def run(self, args: CommandArgs, data: CommandData) -> None:
if self.interface.name == "discord":
message: discord.Message = data.message
guild: discord.Guild = message.guild
guild_id: Optional[int] = guild.id
2019-11-11 08:56:08 +00:00
else:
2019-12-03 00:57:21 +00:00
guild_id = None
response: Dict[str, Any] = await self.interface.call_herald_event("discord", "discord_pause",
guild_id=guild_id)
2019-11-11 08:56:08 +00:00
2019-12-03 00:57:21 +00:00
if response["action"] == "paused":
await data.reply("⏸ Riproduzione messa in pausa.")
2019-11-11 08:56:08 +00:00
2019-12-03 00:57:21 +00:00
elif response["action"] == "resumed":
await data.reply("▶️ Riproduzione ripresa!")