Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion modules/moderation/nickname.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
from typing import TYPE_CHECKING, Self

import discord
from discord import app_commands
from discord.ext import commands
from unidecode import unidecode

import configuration
from botlogging import LogContext, LogLevel
from core import cogs
from core import auxiliary, cogs

if TYPE_CHECKING:
import bot
Expand Down Expand Up @@ -138,6 +139,41 @@ async def response(
context=LogContext(guild=ctx.author.guild),
)

@app_commands.checks.has_permissions(manage_nicknames=True)
@app_commands.command(
name="nicknamefix",
description="Auto adjusts a nickname of the given member",
)
async def fixnickname(
self: Self, interaction: discord.Interaction, member: discord.Member
) -> None:
"""Manually adjusts someones nickname to comply with the nickname filter
Does not send a DM

Args:
interaction (discord.Interaction): The interaction the command was called at
member (discord.Member): The member to update the nickname for
"""
if member.bot:
embed = auxiliary.prepare_deny_embed("Bots don't get new nicknames")
return
new_nickname = format_username(member.display_name)
if new_nickname == member.display_name:
embed = auxiliary.prepare_deny_embed(
f"{member.mention} doesn't need a new nickname"
)
await interaction.response.send_message(embed=embed)
return
await member.edit(
nick=new_nickname,
reason=f"Change nickname command, ran by {interaction.user}",
)
embed = auxiliary.prepare_confirm_embed(
f"{member.mention} name changed to {new_nickname}"
)
await interaction.response.send_message(embed=embed)
return

@commands.Cog.listener()
async def on_member_join(self: Self, member: discord.Member) -> None:
"""
Expand Down
63 changes: 0 additions & 63 deletions modules/moderation/nicknamefix.py

This file was deleted.

Loading