JDJG-Holding-Team / Sincroni

A special version of JDBot by me.
MIT License
1 stars 4 forks source link

Finish properly implenenting blacklisting #11

Open JDJGInc opened 11 months ago

JDJGInc commented 11 months ago

https://github.com/JDJG-Holding-Team/Sincroni/blob/16394636cfa7c827aa582a373f69c8988d6cf500/cogs/global.py#L263

JDJGInc commented 11 months ago

also it needs commands for blacklisting ie global (owner only and eventually global chat moderators)

and the people who can add global link can blacklist people underneath their permissions and hieracy plus other stuff.

JDJGInc commented 11 months ago

This table's goal was to blacklist people from being able send messages to that guild as well as preventing them from sending the message from that guild

Blacklisted users are those who the guild Don't want their messages to be sent to them or to send from their guild Global Blacklisted prevents them for using it at all

This only per the global chat type or all if wanted

blacklisting blocks people from using the bot per guild if guild only if global blacklisting, it stops from sending messages to and in global chat

JDJGInc commented 11 months ago

Filtering by type and blacklisting add commands is necessary.

global blacklist add -> specific guild only global blacklist remove -> specific guild only

owner only versions should exist too.

JDJGInc commented 11 months ago
CREATE TABLE IF NOT EXISTS SINCRONI_BLACKLIST(
   id SERIAL NOT NULL,
   server_id BIGINT NOT NULL,
   entity_id BIGINT NOT NULL,
   pub BOOLEAN DEFAULT FALSE,
   dev BOOLEAN DEFAULT FALSE,
   private BOOLEAN DEFAULT FALSE,
   blacklist_type SMALLINT DEFAULT 0,
   reason TEXT DEFAULT "No reason provided"
)
JDJGInc commented 9 months ago

Command for per guild is practically done

blacklist unblacklist are weird names but oh well.

I think a confirm check may do well:

view = await Confirm.prompt(
            ctx,
            user_id=ctx.author.id,
            content=f"Are you sure you want to unlink {channel.mention} as global chat?",
        )
        if view.value is None:
            await view.message.edit(
                content=f"~~{view.message.content}~~ you didn't respond on time!... not doing anything."
            )
            return
        elif view.value is False:
            await view.message.edit(
                content=f"~~{view.message.content}~~ okay, not unlinking {channel.mention} as global chat."
            )
            return
        else:
            await view.message.edit(content=f"~~{view.message.content}~~ unlinking {channel.mention} as global chat.")
        like that one for global unlink but for global unblacklist
JDJGInc commented 9 months ago

https://github.com/JDJG-Holding-Team/Sincroni/blob/2a3fedcdb5470fd5d45ffffa112c09921b75644a/cogs/global.py#L406