cogs/color/assignment.py
async def on_member_remove(self, member):
        """Sends a goodbye message when a member leaves the server."""

        wc, colors = db.get_many(member.guild.id, "wc", "colors")
        ucolor = utils.find_user_color(member, colors)

        # do nothing if no welcome channel
        if not wc:
            return
        welcome_channel = member.guild.get_channel(wc)

        # generate and send goodbye message
        embed = discord.Embed(title=f"{member.name} has left the server!",
                              description="They won't be missed",
                              color=discord.Color.red())
        embed.set_thumbnail(url=member.avatar_url)
        await welcome_channel.send(embed=embed)

        # remove member and update db
        if ucolor:
            members = ucolor["members"]
            members.remove(member.id)
            db.guilds.update_one(
                {"_id": member.guild.id, "colors.name": ucolor["name"]},
                {"$set": {"colors.$.members": members}}
            )
Sends a goodbye message when a member leaves the server.
Sends a goodbye message when a member leaves the server.
Sends a goodbye message when a member leaves the server .
async def on_member_remove(self, member):
        wc, colors = db.get_many(member.guild.id, "wc", "colors")
        ucolor = utils.find_user_color(member, colors)
        if not wc:
            return
        welcome_channel = member.guild.get_channel(wc)
        embed = discord.Embed(title=f"{member.name} has left the server!",
                              description="They won't be missed",
                              color=discord.Color.red())
        embed.set_thumbnail(url=member.avatar_url)
        await welcome_channel.send(embed=embed)
        if ucolor:
            members = ucolor["members"]
            members.remove(member.id)
            db.guilds.update_one(
                {"_id": member.guild.id, "colors.name": ucolor["name"]},
                {"$set": {"colors.$.members": members}}
            )
async def on_member_remove ( self , member ) : wc , colors = db . get_many ( member . guild . id , "wc" , "colors" ) ucolor = utils . find_user_color ( member , colors ) if not wc : return welcome_channel = member . guild . get_channel ( wc ) embed = discord . Embed ( title = f"{member.name} has left the server!" , description = "They won't be missed" , color = discord . Color . red ( ) ) embed . set_thumbnail ( url = member . avatar_url ) await welcome_channel . send ( embed = embed ) if ucolor : members = ucolor [ "members" ] members . remove ( member . id ) db . guilds . update_one ( { "_id" : member . guild . id , "colors.name" : ucolor [ "name" ] } , { "$set" : { "colors.$.members" : members } } )
Sends a goodbye message when a member leaves the server.
Sends a goodbye message when a member leaves the server .
"""Sends a goodbye message when a member leaves the server.""" # do nothing if no welcome channel # generate and send goodbye message # remove member and update db
self
member