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

30 lines
1 KiB
Python
Raw Normal View History

2020-05-10 22:46:12 +00:00
from typing import *
import royalnet.commands as rc
2019-11-11 08:56:08 +00:00
import discord
2020-05-10 22:46:12 +00:00
class SummonCommand(rc.Command):
2019-11-11 08:56:08 +00:00
name: str = "summon"
aliases = ["cv"]
description: str = "Evoca il bot in un canale vocale."
syntax: str = "[nomecanale]"
2020-05-10 22:46:12 +00:00
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
2019-11-30 13:49:23 +00:00
channel_name = args.joined()
2019-11-11 08:56:08 +00:00
if self.interface.name == "discord":
message: discord.Message = data.message
2019-11-30 13:49:23 +00:00
guild_id = message.guild.id
user_id = message.author.id
else:
guild_id = None
user_id = None
response = await self.interface.call_herald_event("discord", "discord_summon",
channel_name=channel_name, guild_id=guild_id, user_id=user_id)
if self.interface.name == "discord":
await data.reply(f"✅ Mi sono connesso in <#{response['channel']['id']}>!")
2019-11-11 08:56:08 +00:00
else:
2019-11-30 13:49:23 +00:00
await data.reply(f"✅ Mi sono connesso in [b]#{response['channel']['name']}[/b]!")