Skip to content

Various changes to quotes (including mod deletion)#468

Open
le-potate wants to merge 1 commit into
devfrom
moddelquotes
Open

Various changes to quotes (including mod deletion)#468
le-potate wants to merge 1 commit into
devfrom
moddelquotes

Conversation

@le-potate
Copy link
Copy Markdown
Contributor

Moderators can now delete quotes when they are quoted, from the list of quotes of a user, from the allq command, and delete all quotes from a certain user using ?purgequotes

rebuild_mc has been added everywhere where quotes are deleted

the delete emoji in ?lq can now only be clicked by the quote list author or by a mod (whereas any users used to be able to click it before and start the delete prompt, but only the author could use the prompt). The person who clicks the reacts is also the only one that can then delete a quote. By doing this, this fixes #215, since Marty cannot even start the prompt anymore. (The check that the message wasn't written by the bot was still added in case and might be useful in case Marty can ever react on other people's messages).

Resolves #215

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Moderators can now delete quotes when they are quoted, from the list of quotes of a user, from the allq command, and delete all quotes from a certain user using ?purgequotes

rebuild_mc has been added everywhere where quotes are deleted

the delete emoji in ?lq can now only be clicked by the quote list author or by a mod (whereas any users used to be able to click it before and start the delete prompt, but only the author could use the prompt). The person who clicks the reacts is also the only one that can then delete a quote. By doing this, this fixes #215, since Marty cannot even start the prompt anymore. (The check that the message wasn't written by the bot was still added in case and might be useful in case Marty can ever react on other people's messages).
Comment thread cogs/quotes.py
return all((0 <= int(msg.content) <= len(quote_list),
msg.author == user_deleting,
msg.channel == ctx.message.channel,
msg.author != self.bot.user))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Comment thread cogs/quotes.py
conn.commit()
index = int(message.content) - 1
if index == -1:
await ctx.send('Exit delq.', delete_after=60)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you early return here to avoid indenting everything?

Comment thread cogs/quotes.py
except ValueError:
return False

while p.edit_mode:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kinda looks like its duplicating a bunch of code - whats up there?

Comment thread cogs/quotes.py

@commands.command()
@is_moderator()
async def purgequotes(self, ctx, user: str):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make this purge_quotes and add an alias purgequotes to keep the function names pep8?

Comment thread cogs/quotes.py

while p.edit_mode:
if user_deleting == ctx.message.author:
if user_deleting == ctx.message.author:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double if??

Comment thread cogs/quotes.py
p = Pages(ctx,
item_list=quote_list_text,
title='Quotes from {}'.format(quote_author.display_name))
title='Quotes from {}'.format(quote_author.display_name),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace with f-strings for consistency (same for line 390)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [Easy fix] Users can delete the bot's quotes with the ?mix command

3 participants