gradiuscypher / discord_gradiusbot

A gradiusbot for the Discord chat service.
6 stars 7 forks source link

Dont add a deleted user to an exception pool #74

Closed gradiuscypher closed 3 years ago

gradiuscypher commented 6 years ago

It appears that when a user is deleted, it triggers an unban event on servers. To prevent this, we should never add an exception for a user name that looks similar to something like:

Deleted User 27950c0a#2694
gradiuscypher commented 6 years ago

some example code for getting a list of users added to the exception list:

            if split_content[1] == 'deletedusers':
                outfile = open("deleted_users.txt", 'w')
                target_server_id = int(split_content[2])
                target_chan_id = int(split_content[3])
                target_server = client.get_guild(target_server_id)
                target_chan = target_server.get_channel(target_chan_id)

                async for hist_message in target_chan.history(limit=250):
                    if len(hist_message.embeds) > 0:
                        t_embed = hist_message.embeds[0]

                        user_id = None
                        user_name = None

                        for field in t_embed.fields:
                            if field.name == "User ID":
                                user_id = field.value
                            if field.name == "User Name":
                                user_name = field.value

                        if user_name and user_id:
                            if "Deleted User" in user_name:
                                outfile.write(user_name + "," + user_id + "\n")
                outfile.close()