Skip to content

[BUG] Users with names containing words banned by Discord server discovery/community cannot open threads #2934

Closed
@patrickklaeren

Description

@patrickklaeren

Describe the bug
When a user has a word that is banned by Discord server discovery community guidelines (I can add a few, but you can probably imagine which terms), a thread cannot be opened by the user because the Discord API does not want to create a channel with the user's name.

Bot Info
Bot version (check with @modmail about): 3.6.2
Host method (Heroku, self-host, etc): self hosted

To Reproduce
Steps to reproduce the behavior:

  1. Have server enrolled in server discovery
  2. Have anyone with a username containing a banned term message the bot
  3. Check log channel:

image

Error Logs

discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In name: Contains words not allowed for servers in Server Discovery.
2021-01-11 08:45:24 __main__[762] - ERROR: Failed to send message:
Traceback (most recent call last):
  File "/app/bot.py", line 760, in process_dm_modmail
    await thread.send(message)
  File "/app/core/thread.py", line 713, in send
    self.bot.loop.create_task(self.bot.api.append_log(message, channel_id=self.channel.id))
AttributeError: 'NoneType' object has no attribute 'id'
2021-01-11 08:45:30 core.thread[102] - CRITICAL: An error occurred while creating a thread.
Traceback (most recent call last):
  File "/app/core/thread.py", line 95, in setup
    channel = await self.bot.modmail_guild.create_text_channel(
  File "/app/.heroku/python/lib/python3.9/site-packages/discord/guild.py", line 905, in create_text_channel
    data = await self._create_channel(name, overwrites, ChannelType.text, category, reason=reason, **options)
  File "/app/.heroku/python/lib/python3.9/site-packages/discord/http.py", line 245, in request
    raise HTTPException(r, data)

Possible solution
Would it be possible to add a new configuration to create channels based on snowflakes, i.e. the user IDs, making threads name agnostic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions