calebj / calebj-cogs

⚙ Cogs for Red-Discordbot
https://cogs.red/cogs/calebj/calebj-cogs/
GNU General Public License v3.0
47 stars 36 forks source link

[serverquotes] Suggestions for permissions, display and global quotes #29

Closed skeith closed 6 years ago

skeith commented 7 years ago
calebj commented 6 years ago

Added PIL library rendering for @skeith Example

skeith commented 6 years ago

Awww thank you. Forgot I even have this issue opened. Anyway, the image not have to be that one I sent

skeith commented 6 years ago

This probably a small enhancement. Make adding quote confirmation show its quote number. Example given : Quote #15 added!

calebj commented 6 years ago

This probably a small enhancement. Make adding quote confirmation show its quote number.

That'll only be valid for when quotes can't shift around in their list. Right now, deleting a lower-numbered quote will shift the ones above it down, making the number shown in your example meaningless.

skeith commented 6 years ago

I see. The reason I want suggest this is to know the number of stored quote without listing them, but yeah, I never thought about deletion

skeith commented 6 years ago

Better error handling when there is no quote found. Currently prints Error in command 'quote'. Check your console or logs for details.

calebj commented 6 years ago

I haven't forgotten about this. Serverquotes just isn't very popular.

You can get global quotes on either tmerc or tekulvw's cogs.

That said, I'd like to make the cog able to work in both a local or global context, by assigning a global quote number in addition to the server number it does now. A simple mapping would eliminate the need to duplicate data.

calebj commented 6 years ago

The version in the develop branch now has a lot of improvements, plus text search. It also checks for manage_messages or administrator permissions on top of the normal role checks.

I don't know if PIL is worth adding when embeds + markdown exists, and I'm still thinking of how I want to go about global/cross-server quoting. The database keeps track of both server quote ID and a global ID, but none of the global things are exposed yet. I mainly want to make sure that members can't see quotes from servers they aren't in; perhaps with the option of making owner-added "global" quotes accessible despite that. Thoughts?

skeith commented 6 years ago

Embed works too. PIL suggestion is there just as an eye candy. It sure will looks good from end user view, but I understand the hell of coding it.

Global quotes should be readable by anyone, without any context of what server they came from. Server quotes should only be readable by that server only and I think there should be another command that is able to change any server quotes becomes global one.

for storage, I can only see having two separate database. one for global, one for server

And oh no, why do I have close and comment button? image

I almost clicked that

calebj commented 6 years ago

The database in the current design stores them in a single table, but the query commands are restricted by server ID. It would be straightforward to add a column for a global flag, but who gets to decide what quotes are global? If anyone with quote add permissions can also make a quote public, I'd definitely have to also add a NSFW flag.

You have the button because you opened the issue.

skeith commented 6 years ago

ah right, silly me.

I'd say, only bot owner or server owner can make a quote global. That being said, I guess the docstring for global flag should warn the user about the meaning of a quote being global.

For global deletion, lock it to bot owner

calebj commented 6 years ago

Fair enough. Since the cog is up to date and stable, I'll work on some other stuff before adding the global quote feature.

If you're happy with the embeds, permissions, and search miss handling, would you mind ticking those off? PIL probably isn't gonna happen in V2.

skeith commented 6 years ago

as for permission, I think v3 permission can allow addquote to be used by another role

for v2, permbreaker cog exist but if you do plan to add your own permission for addquote, that'll be nice

calebj commented 6 years ago

@skeith the latest version in the develop branch has global quotes implemented. There's no toggle to mark ALL quotes as global, and I don't think I want to expose that. But there is a workaround. Calling:

cog._update_quotes(enforce_key=False, is_global=True)

will mark all quotes as global.

Of course, if you just want add a global quote that's independent of any server, you can use [p]gquote add, add-msg or add-nm, even from in a server. Only the owner can call those.

skeith commented 6 years ago

I will try to test it as soon as I have free time