From d907757227be853322738671dba8ae7a2b026043 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 10 Sep 2019 13:45:19 +0200 Subject: [PATCH] Don't crash if the bot is summoned in a private chat --- royalnet/commands/royalgames/summon.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/royalnet/commands/royalgames/summon.py b/royalnet/commands/royalgames/summon.py index c583a9dd..99ed8733 100644 --- a/royalnet/commands/royalgames/summon.py +++ b/royalnet/commands/royalgames/summon.py @@ -61,7 +61,11 @@ class SummonCommand(Command): channel = matching_channels[0] else: author: discord.Member = message.author - voice: typing.Optional[discord.VoiceState] = author.voice + try: + voice: typing.Optional[discord.VoiceState] = author.voice + except AttributeError: + await data.reply("⚠️ Non puoi evocare il bot da una chat privata!") + return if voice is None: await data.reply("⚠️ Non sei connesso a nessun canale vocale!") return