-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: dev
Are you sure you want to change the base?
Conversation
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)) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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)
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: