Skip to content

Custom wrong name messages

ContestedWheel edited this page May 6, 2025 · 8 revisions

Important

This tutorial is now archived because Ballsdex has made their own way to add custom wrong name messages. If you want to ditch this method of adding custom wrong name messages in favor of the official method, simply update your bot using git pull and then make sure to rebuild using docker compose build.


Some dexes even go as far to add their own custom wrong name messages, mainly CarFigures engine based bots. In this tutorial, we will be learning how to add custom wrong name messages to our bot using Ballsdex.

One custom wrong name message

  1. Go to ballsdex/packages/countryballs

You will see the following files:

image

  1. Open countryball.py in your text editor and scroll down until you see this part (or go to line 82):
        else:
            await interaction.followup.send(
                f"{interaction.user.mention} Wrong name!",
                allowed_mentions=discord.AllowedMentions(users=player.can_be_mentioned),
                ephemeral=False,
            )
  1. Change f"{interaction.user.mention} Wrong name!", to anything of your choice.

Tip

Let's say if I wanna change my wrong name message to say "Oops, that's not the right name, try again!", I will replace the line with f"{interaction.user.mention} Oops, that's not the right name, try again!",

Once you replace the line, it should look like this:

        else:
            await interaction.followup.send(
                f"{interaction.user.mention} Oops, that's not the right name, try again!",
                allowed_mentions=discord.AllowedMentions(users=player.can_be_mentioned),
                ephemeral=False,
            )

If you want the message to say what the player typed to get the wrong name, use {self.name.value}. An example is shown below:

        else:
            await interaction.followup.send(
                f"{interaction.user.mention} Oops, that's not the right name, try again! You entered: `{self.name.value}`",
                allowed_mentions=discord.AllowedMentions(users=player.can_be_mentioned),
                ephemeral=False,
            )
  1. Save the file by pressing CTRL + S on your keyboard or File > Save on your text editor, then close it.

  2. Restart the bot using docker compose restart. Once it's back up, make sure the message works by using /admin countryballs spawn to spawn a ball.

Important

If you get "An error occured when running the command. Contact support if this persists.", you most likely didn't replace the line correctly. Check this by opening countryball.py and look for any errors you have possibly made trying to replace the line.

Multiple wrong name messages

This section will be the same as adding multiple spawn messages in the Custom spawn messages tutorial.

  1. In the countryballs folder, create a new Text Document.

image

  1. Name the file wrongnames and change .txt to .py

A popup will ask if you are sure you want to change the file extension. Click "Yes" on this popup.

image

  1. Open the new file using your text editor. then copy and paste the following below into the file:
wrongnamelist = [
    "Wow",
    "Hello",
    "The french",
]

Important

If you want to add a new wrong name message, look at the gif I made below to help you. Make sure you add a comma at the end of each wrong name message you add, or you will get an error.

spawn

  1. Save the file by pressing CTRL + S on your keyboard or File > Save on your text editor, then close it.

  2. Open countryball.py and import the wrong name message list by using this below:

from ballsdex.packages.countryballs.wrongnames import wrongnamelist

It should look like this:

from ballsdex.packages.countryballs.wrongnames import wrongnamelist
from ballsdex.settings import settings

if TYPE_CHECKING:
    from ballsdex.core.bot import BallsDexBot

log = logging.getLogger("ballsdex.packages.countryballs")

Note

If you are using both custom spawn messages and custom wrong name messages, it will look like this instead:

from ballsdex.packages.countryballs.spawnmsgs import spawnmsglist
from ballsdex.packages.countryballs.wrongnames import wrongnamelist
from ballsdex.settings import settings

if TYPE_CHECKING:
    from ballsdex.core.bot import BallsDexBot

log = logging.getLogger("ballsdex.packages.countryballs")

Then, scroll down to line 82 and replace f"{interaction.user.mention} Wrong name!", with (f"{interaction.user.mention} " + (random.choice(wrongnamelist))),

It should look like this:

        else:
            await interaction.followup.send(
                (f"{interaction.user.mention} " + (random.choice(wrongnamelist))),
                allowed_mentions=discord.AllowedMentions(users=player.can_be_mentioned),
                ephemeral=False,
            )
  1. Save the file by pressing CTRL + S on your keyboard or File > Save on your text editor, then close it.

  2. Restart the bot using docker compose restart. Once it's back up, make sure the wrong name messages works by using /admin countryballs spawn to spawn a ball.

Yet again, thanks to porcelainscars for coding the multiple spawn messages, I just edited it so that you could do the same whenever you get a wrong name.

Clone this wiki locally