Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various changes to quotes (including mod deletion) #468

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

le-potate
Copy link
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).
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
Member

Choose a reason for hiding this comment

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

nice

conn.commit()
index = int(message.content) - 1
if index == -1:
await ctx.send('Exit delq.', delete_after=60)
Copy link
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?

except ValueError:
return False

while p.edit_mode:
Copy link
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?

@@ -466,6 +538,77 @@ async def generate(self, ctx, seed: str = None, min_length: int = 1):

await ctx.send(' '.join(longest_sentence))

@commands.command()
@is_moderator()
async def purgequotes(self, ctx, user: str):
Copy link
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?


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

Choose a reason for hiding this comment

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

double if??

@@ -274,55 +291,61 @@ async def list_quotes(self, ctx, author: discord.Member = None):

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
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