-
-
Notifications
You must be signed in to change notification settings - Fork 750
Relay the moderator's reason for !superstarify to the user
#1319
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f537768
Bot relays the infraction reason in the DM.
swfarnsworth d7e94f2
Add `starify` and `unstarify` as command aliases.
swfarnsworth 873dcd7
Merge branch 'master' of https://github.com/python-discord/bot into s…
swfarnsworth 0f66fe3
User gets a more detailed message from the bot
swfarnsworth 032b64f
Use the original wording of the public embed, but change the title to…
swfarnsworth 66ea30b
Merge branch 'master' into swfarnsworth/superstar
swfarnsworth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,14 +104,14 @@ async def on_member_join(self, member: Member) -> None: | |
|
|
||
| await self.reapply_infraction(infraction, action) | ||
|
|
||
| @command(name="superstarify", aliases=("force_nick", "star")) | ||
| @command(name="superstarify", aliases=("force_nick", "star", "starify")) | ||
| async def superstarify( | ||
| self, | ||
| ctx: Context, | ||
| member: Member, | ||
| duration: Expiry, | ||
| *, | ||
| reason: str = None, | ||
| reason: str = '', | ||
| ) -> None: | ||
| """ | ||
| Temporarily force a random superstar name (like Taylor Swift) to be the user's nickname. | ||
|
|
@@ -128,16 +128,16 @@ async def superstarify( | |
|
|
||
| Alternatively, an ISO 8601 timestamp can be provided for the duration. | ||
|
|
||
| An optional reason can be provided. If no reason is given, the original name will be shown | ||
| in a generated reason. | ||
| An optional reason can be provided, which would be added to a message stating their old nickname | ||
| and linking to the nickname policy. | ||
| """ | ||
| if await _utils.get_active_infraction(ctx, member, "superstar"): | ||
| return | ||
|
|
||
| # Post the infraction to the API | ||
| old_nick = member.display_name | ||
| reason = reason or f"old nick: {old_nick}" | ||
| infraction = await _utils.post_infraction(ctx, member, "superstar", reason, duration, active=True) | ||
| infraction_reason = f'Old nickname: {old_nick}. {reason}' | ||
| infraction = await _utils.post_infraction(ctx, member, "superstar", infraction_reason, duration, active=True) | ||
| id_ = infraction["id"] | ||
|
|
||
| forced_nick = self.get_nick(id_, member.id) | ||
|
|
@@ -152,37 +152,38 @@ async def action() -> None: | |
| old_nick = escape_markdown(old_nick) | ||
| forced_nick = escape_markdown(forced_nick) | ||
|
|
||
| superstar_reason = f"Your nickname didn't comply with our [nickname policy]({NICKNAME_POLICY_URL})." | ||
| nickname_info = textwrap.dedent(f""" | ||
| Old nickname: `{old_nick}` | ||
| New nickname: `{forced_nick}` | ||
| """).strip() | ||
|
|
||
| user_message = ( | ||
| f"Your previous nickname, **{old_nick}**, " | ||
| f"was so bad that we have decided to change it. " | ||
| f"Your new nickname will be **{forced_nick}**.\n\n" | ||
| "{reason}" | ||
| f"You will be unable to change your nickname until **{expiry_str}**. " | ||
|
HassanAbouelela marked this conversation as resolved.
|
||
| "If you're confused by this, please read our " | ||
| f"[official nickname policy]({NICKNAME_POLICY_URL})." | ||
| ).format | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels a bit unconventional and odd, but it's quite smart. |
||
|
|
||
| successful = await self.apply_infraction( | ||
| ctx, infraction, member, action(), | ||
| user_reason=superstar_reason, | ||
| user_reason=user_message(reason=f'**Additional details:** {reason}\n\n' if reason else ''), | ||
| additional_info=nickname_info | ||
| ) | ||
|
|
||
| # Send an embed with the infraction information to the invoking context if | ||
| # superstar was successful. | ||
| # Send an embed with to the invoking context if superstar was successful. | ||
| if successful: | ||
| log.trace(f"Sending superstar #{id_} embed.") | ||
| embed = Embed( | ||
| title="Congratulations!", | ||
| title="Superstarified!", | ||
| colour=constants.Colours.soft_orange, | ||
| description=( | ||
| f"Your previous nickname, **{old_nick}**, " | ||
| f"was so bad that we have decided to change it. " | ||
| f"Your new nickname will be **{forced_nick}**.\n\n" | ||
| f"You will be unable to change your nickname until **{expiry_str}**.\n\n" | ||
| "If you're confused by this, please read our " | ||
| f"[official nickname policy]({NICKNAME_POLICY_URL})." | ||
| ) | ||
| description=user_message(reason='') | ||
| ) | ||
| await ctx.send(embed=embed) | ||
|
|
||
| @command(name="unsuperstarify", aliases=("release_nick", "unstar")) | ||
| @command(name="unsuperstarify", aliases=("release_nick", "unstar", "unstarify")) | ||
| async def unsuperstarify(self, ctx: Context, member: Member) -> None: | ||
| """Remove the superstarify infraction and allow the user to change their nickname.""" | ||
| await self.pardon_infraction(ctx, "superstar", member) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.