2019-11-11 08:56:08 +00:00
|
|
|
import discord
|
|
|
|
from royalnet.commands import *
|
|
|
|
|
|
|
|
|
|
|
|
class SummonCommand(Command):
|
|
|
|
name: str = "summon"
|
|
|
|
|
|
|
|
aliases = ["cv"]
|
|
|
|
|
|
|
|
description: str = "Evoca il bot in un canale vocale."
|
|
|
|
|
|
|
|
syntax: str = "[nomecanale]"
|
|
|
|
|
|
|
|
async def run(self, args: CommandArgs, data: 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]!")
|