diff --git a/Cogs/join_alert.py b/Cogs/join_alert.py index 8891c54..c135f2e 100644 --- a/Cogs/join_alert.py +++ b/Cogs/join_alert.py @@ -38,26 +38,27 @@ async def on_guild_join(self, guild): @commands.Cog.listener() async def on_guild_remove(self, guild): - embed = Embeds.emb( - Embeds.red, - guild.name, - f""" - Guild Id: {guild.id} - Owner Id: {guild.owner_id} - Vanity Invite Link: {guild.vanity_url_code} - Members Count: {guild.member_count} - """, - ) - db.config.delete_one({"guild_id": guild.id}) - db.traffic.delete_one({"guild_id": guild.id}) - await send_webhook( - embed=embed, - webhook_url=os.getenv("whtraffic"), - username="Guild Leave Logger", - avatar_url="https://cdn.discordapp.com/avatars/10" - "87375480304451727/f780c7c8c052c66c89f9270aebd63b" - "c2.png?size=1024", - ) + if guild.name: + embed = Embeds.emb( + Embeds.red, + guild.name, + f""" + Guild Id: {guild.id} + Owner Id: {guild.owner_id} + Vanity Invite Link: {guild.vanity_url_code} + Members Count: {guild.member_count} + """, + ) + db.config.delete_one({"guild_id": guild.id}) + db.traffic.delete_one({"guild_id": guild.id}) + await send_webhook( + embed=embed, + webhook_url=os.getenv("whtraffic"), + username="Guild Leave Logger", + avatar_url="https://cdn.discordapp.com/avatars/10" + "87375480304451727/f780c7c8c052c66c89f9270aebd63b" + "c2.png?size=1024", + ) def setup(client: commands.Bot):