-
Notifications
You must be signed in to change notification settings - Fork 0
Custom wrong name messages
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.
- Go to
ballsdex/packages/countryballs
You will see the following files:

- Open
countryball.pyin 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,
)- 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,
)-
Save the file by pressing
CTRL + Son your keyboard orFile > Saveon your text editor, then close it. -
Restart the bot using
docker compose restart. Once it's back up, make sure the message works by using/admin countryballs spawnto 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.
This section will be the same as adding multiple spawn messages in the Custom spawn messages tutorial.
- In the
countryballsfolder, create a new Text Document.

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

- 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.

-
Save the file by pressing
CTRL + Son your keyboard orFile > Saveon your text editor, then close it. -
Open
countryball.pyand import the wrong name message list by using this below:
from ballsdex.packages.countryballs.wrongnames import wrongnamelistIt 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,
)-
Save the file by pressing
CTRL + Son your keyboard orFile > Saveon your text editor, then close it. -
Restart the bot using
docker compose restart. Once it's back up, make sure the wrong name messages works by using/admin countryballs spawnto 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.
If you have any errors, join the Ballsdex Developers server by clicking this blue text.