From 417eea485904f2a9b7d6ab71a9480096596d46a7 Mon Sep 17 00:00:00 2001 From: bobloy Date: Mon, 22 Oct 2018 12:24:19 -0400 Subject: [PATCH] Fix to bugs --- flag/flag.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flag/flag.py b/flag/flag.py index 702e834..94269bf 100644 --- a/flag/flag.py +++ b/flag/flag.py @@ -86,6 +86,8 @@ class Flag(Cog): # await self.config.guild(guild).flags.set_raw(str(member.id), value=flags) async with self.config.guild(guild).flags() as flags: + if str(member.id) not in flags: + flags[str(member.id)] = [] flags[str(member.id)].append(flag) outembed = await self._list_flags(member) @@ -93,7 +95,10 @@ class Flag(Cog): if outembed: await ctx.send(embed=outembed) if await self.config.guild(guild).dm(): - await member.send(embed=outembed) + try: + await member.send(embed=outembed) + except discord.Forbidden: + await ctx.send("DM-ing user failed") else: await ctx.send("This member has no flags.. somehow..")