From 2cd9debabc1d5ad9d448e414fa0f7bcc32eaa115 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 21:34:36 +0300 Subject: [PATCH 01/14] adding plural collectible name to settings --- ballsdex/settings.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ballsdex/settings.py b/ballsdex/settings.py index d4666249f..05e804fe1 100644 --- a/ballsdex/settings.py +++ b/ballsdex/settings.py @@ -28,6 +28,8 @@ class Settings: Prefix for text commands, mostly unused. Defaults to "b." collectible_name: str Usually "countryball", can be replaced when possible + plural_collectible_name: str + Usually "countryballs", can be replaced when possible bot_name: str Usually "BallsDex", can be replaced when possible players_group_cog_name: str @@ -58,6 +60,7 @@ class Settings: prefix: str = "b." collectible_name: str = "countryball" + plural_collectible_name: str = "countryballs" bot_name: str = "BallsDex" players_group_cog_name: str = "balls" @@ -100,6 +103,7 @@ def read_settings(path: "Path"): settings.co_owners = content.get("owners", {}).get("co-owners", []) settings.collectible_name = content["collectible-name"] + settings.plural_collectible_name = content["plural-collectible-name"] settings.bot_name = content["bot-name"] settings.players_group_cog_name = content["players-group-cog-name"] @@ -151,9 +155,13 @@ def write_default_settings(path: "Path"): privacy-policy: https://gist.github.com/laggron42/1eaa122013120cdfcc6d27f9485fe0bf # WORK IN PROGRESS, DOES NOT FULLY WORK -# override the name "countryballs" in the bot +# override the name "countryball" in the bot collectible-name: countryball +# WORK IN PROGRESS, DOES NOT FULLY WORK +# override the name "countryballs" in the bot +plural-collectible-name: countryballs + # WORK IN PROGRESS, DOES NOT FULLY WORK # override the name "BallsDex" in the bot bot-name: BallsDex @@ -208,6 +216,7 @@ def update_settings(path: "Path"): add_owners = True add_config_ref = "# yaml-language-server: $schema=json-config-ref.json" not in content add_max_favorites = "max-favorites:" not in content + add_plural_collectible = "plural-collectible-name" not in content for line in content.splitlines(): if line.startswith("owners:"): @@ -234,6 +243,13 @@ def update_settings(path: "Path"): content += """ # maximum amount of favorites that are allowed max-favorites: 50 +""" + + if add_plural_collectible: + content += """ +# WORK IN PROGRESS, DOES NOT FULLY WORK +# override the name "countryballs" in the bot +plural-collectible-name: countryballs """ if any((add_owners, add_config_ref)): From 5ef247d72e5ba0075fb85fb040f97096800cb321 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 21:37:32 +0300 Subject: [PATCH 02/14] adding plural collectible name to json-config-ref.json --- json-config-ref.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/json-config-ref.json b/json-config-ref.json index 6c768f48a..cc00db8db 100644 --- a/json-config-ref.json +++ b/json-config-ref.json @@ -50,9 +50,14 @@ }, "collectible-name": { "type": "string", - "description": "The name of the collectible, used everywhere except command descriptions. An 's' is appended to the end of this string for pluralization", + "description": "The name of the collectible, used everywhere except command descriptions.", "example": "ball" }, + "plural-collectible-name": { + "type": "string", + "description": "The plural name of the collectible, used everywhere except command descriptions.", + "example": "balls" + }, "bot-name": { "type": "string", "description": "The name of the bot, used in places such as the /completion command", @@ -151,4 +156,4 @@ "minimum": 0 } } -} \ No newline at end of file +} From 4c4dacd4dd5ff1c4a89a60a92fec7a46915afa8a Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 21:59:48 +0300 Subject: [PATCH 03/14] changing collectible_name+s to plural collectible name --- ballsdex/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballsdex/__main__.py b/ballsdex/__main__.py index 4f2f6d28b..84437b868 100755 --- a/ballsdex/__main__.py +++ b/ballsdex/__main__.py @@ -73,7 +73,7 @@ def reset_settings(path: Path): def print_welcome(): print("[green]{0:-^50}[/green]".format(f" {settings.bot_name} bot ")) - print("[green]{0: ^50}[/green]".format(f" Collect {settings.collectible_name}s ")) + print("[green]{0: ^50}[/green]".format(f" Collect {settings.plural_collectible_name} ")) print("[blue]{0:^50}[/blue]".format("Discord bot made by El Laggron")) print("") print(" [red]{0:<20}[/red] [yellow]{1:>10}[/yellow]".format("Bot version:", bot_version)) From 2fd18eee9317818c83e7421a4a8446750423d971 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 22:35:14 +0300 Subject: [PATCH 04/14] changing to plural collectible name in players cog --- ballsdex/packages/players/cog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ballsdex/packages/players/cog.py b/ballsdex/packages/players/cog.py index 7813ab66b..46d7172b6 100644 --- a/ballsdex/packages/players/cog.py +++ b/ballsdex/packages/players/cog.py @@ -78,8 +78,8 @@ async def donation_policy( player.donation_policy = DonationPolicy(policy.value) if policy.value == DonationPolicy.ALWAYS_ACCEPT: await interaction.response.send_message( - f"Setting updated, you will now receive all donated {settings.collectible_name}s " - "immediately." + "Setting updated, you will now receive all donated " + f"{settings.plural_collectible_name} immediately." ) elif policy.value == DonationPolicy.REQUEST_APPROVAL: await interaction.response.send_message( From b9cae383f864fda783c754d4323ee399b553647d Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:04:47 +0300 Subject: [PATCH 05/14] changing to plural collectible name in trade menu --- ballsdex/packages/trade/menu.py | 36 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/ballsdex/packages/trade/menu.py b/ballsdex/packages/trade/menu.py index 8ee2c5c45..c4fa65da4 100644 --- a/ballsdex/packages/trade/menu.py +++ b/ballsdex/packages/trade/menu.py @@ -168,7 +168,7 @@ def _generate_embed(self): remove_command = self.cog.remove.extras.get("mention", "`/trade remove`") view_command = self.cog.view.extras.get("mention", "`/trade view`") - self.embed.title = f"{settings.collectible_name.title()}s trading" + self.embed.title = f"{settings.plural_collectible_name.title()} trading" self.embed.color = discord.Colour.blurple() self.embed.description = ( f"Add or remove {settings.collectible_name}s you want to propose to the other player " @@ -176,7 +176,8 @@ def _generate_embed(self): "Once you're finished, click the lock button below to confirm your proposal.\n" "You can also lock with nothing if you're receiving a gift.\n\n" "*You have 30 minutes before this interaction ends.*\n\n" - f"Use the {view_command} command to see the full list of {settings.collectible_name}s " + f"Use the {view_command} command to see the full " + f"list of {settings.plural_collectible_name}." ) self.embed.set_footer( text="This message is updated every 15 seconds, " @@ -328,7 +329,7 @@ async def confirm(self, trader: TradingUser) -> bool: except InvalidTradeOperation: log.warning(f"Illegal trade operation between {self.trader1=} and {self.trader2=}") self.embed.description = ( - f":warning: An attempt to modify the {settings.collectible_name}s " + f":warning: An attempt to modify the {settings.plural_collectible_name} " "during the trade was detected and the trade was cancelled." ) self.embed.colour = discord.Colour.red() @@ -411,7 +412,7 @@ async def select_all_button(self, interaction: discord.Interaction, button: Butt self.balls_selected.add(ball_instance) await interaction.followup.send( ( - f"All {settings.collectible_name}s on this page have been selected.\n" + f"All {settings.plural_collectible_name} on this page have been selected.\n" "Note that the menu may not reflect this change until you change page." ), ephemeral=True, @@ -434,13 +435,14 @@ async def confirm_button(self, interaction: discord.Interaction, button: Button) ) if any(ball in trader.proposal for ball in self.balls_selected): return await interaction.followup.send( - f"You have already added some of the {settings.collectible_name}s you selected.", + "You have already added some of the " + f"{settings.plural_collectible_name} you selected.", ephemeral=True, ) if len(self.balls_selected) == 0: return await interaction.followup.send( - f"You have not selected any {settings.collectible_name}s " + f"You have not selected any {settings.plural_collectible_name} " "to add to your proposal.", ephemeral=True, ) @@ -452,11 +454,12 @@ async def confirm_button(self, interaction: discord.Interaction, button: Button) ) trader.proposal.append(ball) await ball.lock_for_trade() - grammar = "" if len(self.balls_selected) == 1 else "s" + grammar = ( + f"{settings.collectible_name}" if len(self.balls_selected) == 1 + else f"{settings.plural_collectible_name}" + ) await interaction.followup.send( - f"{len(self.balls_selected)} {settings.collectible_name}" - f"{grammar} added to your proposal.", - ephemeral=True, + f"{len(self.balls_selected)} {grammar} added to your proposal.", ephemeral=True ) self.balls_selected.clear() @@ -465,10 +468,11 @@ async def clear_button(self, interaction: discord.Interaction, button: Button): await interaction.response.defer(thinking=True, ephemeral=True) self.balls_selected.clear() await interaction.followup.send( - f"You have cleared all currently selected {settings.collectible_name}s." - f"This does not affect {settings.collectible_name}s within your trade.\n" - "There may be an instance where it shows balls on the current page as selected, " - "this is not the case - changing page will show the correct state.", + f"You have cleared all currently selected {settings.plural_collectible_name}." + f"This does not affect {settings.plural_collectible_name} within your trade.\n" + f"There may be an instance where it shows {settings.plural_collectible_name} on the" + " current page as selected, this is not the case - " + "changing page will show the correct state.", ephemeral=True, ) @@ -509,7 +513,7 @@ def set_options(self, players: List[TradingUser]): label=f"{user_obj.display_name}", description=( f"ID: {user_obj.id} | {len(player.proposal)} " - f"{settings.collectible_name}s" + f"{settings.plural_collectible_name}" ), value=f"{user_obj.id}", ) @@ -533,7 +537,7 @@ async def select_player_menu( ball_instances = trade_player.proposal if len(ball_instances) == 0: return await interaction.followup.send( - f"{trade_player.user} has not added any {settings.collectible_name}s.", + f"{trade_player.user} has not added any {settings.plural_collectible_name}.", ephemeral=True, ) From d05ef4395b02cfe88dcf4f749679c8fdfa4fcab0 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:30:34 +0300 Subject: [PATCH 06/14] changing to plural collectible name in admin cog --- ballsdex/packages/admin/cog.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/ballsdex/packages/admin/cog.py b/ballsdex/packages/admin/cog.py index 8e0015243..f43b32dda 100644 --- a/ballsdex/packages/admin/cog.py +++ b/ballsdex/packages/admin/cog.py @@ -293,7 +293,7 @@ async def cooldown( informations.append("The manager is currently on cooldown.") if delta < 600: informations.append( - f"The manager is less than 10 minutes old, {settings.collectible_name}s " + f"The manager is less than 10 minutes old, {settings.plural_collectible_name} " "cannot spawn at the moment." ) if informations: @@ -464,7 +464,7 @@ async def update_message_loop(): task.cancel() await interaction.followup.edit_message( "@original", # type: ignore - content=f"Successfully spawned {spawned} {settings.collectible_name}s " + content=f"Successfully spawned {spawned} {settings.plural_collectible_name} " f"in {channel.mention}!", ) finally: @@ -1139,11 +1139,11 @@ async def balls_reset( await interaction.response.defer(ephemeral=True, thinking=True) if not percentage: - text = f"Are you sure you want to delete {user}'s {settings.collectible_name}s?" + text = f"Are you sure you want to delete {user}'s {settings.plural_collectible_name}?" else: text = ( f"Are you sure you want to delete {percentage}% of " - f"{user}'s {settings.collectible_name}s?" + f"{user}'s {settings.plural_collectible_name}?" ) view = ConfirmChoiceView(interaction) await interaction.followup.send( @@ -1163,11 +1163,12 @@ async def balls_reset( else: count = await BallInstance.filter(player=player).delete() await interaction.followup.send( - f"{count} {settings.collectible_name}s from {user} have been deleted.", ephemeral=True + f"{count} {settings.plural_collectible_name} from {user} have been deleted.", + ephemeral=True, ) await log_action( f"{interaction.user} deleted {percentage or 100}% of " - f"{player}'s {settings.collectible_name}s.", + f"{player}'s {settings.plural_collectible_name}.", self.bot, ) @@ -1642,11 +1643,11 @@ async def guild( embed.add_field(name="Spawn enabled:", value=spawn_enabled) embed.add_field(name="Created at:", value=format_dt(guild.created_at, style="F")) embed.add_field( - name=f"{settings.collectible_name.title()}s caught ({days} days):", + name=f"{settings.plural_collectible_name.title()} caught ({days} days):", value=len(total_server_balls), ) embed.add_field( - name="Amount of users who caught\n" f"{settings.collectible_name}s ({days} days):", + name=f"Amount of users who caught\n{settings.plural_collectible_name} ({days} days):", value=len(set([x.player.discord_id for x in total_server_balls])), ) @@ -1689,27 +1690,27 @@ async def user( color=discord.Color.blurple(), ) embed.add_field( - name=f"{settings.collectible_name.title()}s caught ({days} days):", + name=f"{settings.plural_collectible_name.title()} caught ({days} days):", value=len(total_user_balls), ) embed.add_field( - name=f"Unique {settings.collectible_name}s caught ({days} days):", + name=f"Unique {settings.plural_collectible_name} caught ({days} days):", value=len(set(total_user_balls)), ) embed.add_field( - name=f"Total servers with {settings.collectible_name}s caught ({days} days):", + name=f"Total servers with {settings.plural_collectible_name} caught ({days} days):", value=len(set([x.server_id for x in total_user_balls])), ) embed.add_field( - name=f"Total {settings.collectible_name}s caught:", + name=f"Total {settings.plural_collectible_name} caught:", value=await BallInstance.filter(player__discord_id=user.id).count(), ) embed.add_field( - name=f"Total unique {settings.collectible_name}s caught:", + name=f"Total unique {settings.plural_collectible_name} caught:", value=len(set([x.countryball for x in total_user_balls])), ) embed.add_field( - name=f"Total servers with {settings.collectible_name}s caught:", + name=f"Total servers with {settings.plural_collectible_name} caught:", value=len(set([x.server_id for x in total_user_balls])), ) embed.set_thumbnail(url=user.display_avatar) # type: ignore From 83d9754df00cfd2badae8809079f8e9b6f57a5a2 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:35:47 +0300 Subject: [PATCH 07/14] changing to plural collectible name in balls cog --- ballsdex/packages/balls/cog.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ballsdex/packages/balls/cog.py b/ballsdex/packages/balls/cog.py index 39958447d..9dcae1510 100644 --- a/ballsdex/packages/balls/cog.py +++ b/ballsdex/packages/balls/cog.py @@ -166,11 +166,11 @@ async def list( except DoesNotExist: if user_obj == interaction.user: await interaction.followup.send( - f"You don't have any {settings.collectible_name}s yet." + f"You don't have any {settings.plural_collectible_name} yet." ) else: await interaction.followup.send( - f"{user_obj.name} doesn't have any {settings.collectible_name}s yet." + f"{user_obj.name} doesn't have any {settings.plural_collectible_name} yet." ) return if user is not None: @@ -212,12 +212,12 @@ async def list( if user_obj == interaction.user: await interaction.followup.send( f"You don't have any {special_txt}{ball_txt} " - f"{settings.collectible_name}s yet." + f"{settings.plural_collectible_name} yet." ) else: await interaction.followup.send( f"{user_obj.name} doesn't have any " - f"{special_txt}{ball_txt} {settings.collectible_name}s yet." + f"{special_txt}{ball_txt} {settings.plural_collectible_name} yet." ) return if reverse: @@ -228,7 +228,7 @@ async def list( await paginator.start() else: await paginator.start( - content=f"Viewing {user_obj.name}'s {settings.collectible_name}s" + content=f"Viewing {user_obj.name}'s {settings.plural_collectible_name}" ) @app_commands.command() @@ -260,7 +260,7 @@ async def completion( except DoesNotExist: await interaction.response.send_message( f"{user_obj.name} doesn't have any " - f"{extra_text}{settings.collectible_name}s yet." + f"{extra_text}{settings.plural_collectible_name} yet." ) return if await inventory_privacy(self.bot, interaction, player, user_obj) is False: @@ -280,7 +280,7 @@ async def completion( } if not bot_countryballs: await interaction.response.send_message( - f"There are no {extra_text}{settings.collectible_name}s" + f"There are no {extra_text}{settings.plural_collectible_name}" " registered on this bot yet.", ephemeral=True, ) @@ -329,18 +329,18 @@ def fill_fields(title: str, emoji_ids: set[int]): if owned_countryballs: # Getting the list of emoji IDs from the IDs of the owned countryballs fill_fields( - f"Owned {settings.collectible_name}s", + f"Owned {settings.plural_collectible_name}", set(bot_countryballs[x] for x in owned_countryballs), ) else: entries.append((f"__**Owned {settings.collectible_name}s**__", "Nothing yet.")) if missing := set(y for x, y in bot_countryballs.items() if x not in owned_countryballs): - fill_fields(f"Missing {settings.collectible_name}s", missing) + fill_fields(f"Missing {settings.plural_collectible_name}", missing) else: entries.append( ( - f"__**:tada: No missing {settings.collectible_name}s, " + f"__**:tada: No missing {settings.plural_collectible_name}, " "congratulations! :tada:**__", "\u200B", ) @@ -405,7 +405,7 @@ async def last(self, interaction: discord.Interaction, user: discord.User | None except DoesNotExist: msg = f"{'You do' if user is None else f'{user_obj.display_name} does'}" await interaction.followup.send( - f"{msg} not have any {settings.collectible_name}s yet.", + f"{msg} not have any {settings.plural_collectible_name} yet.", ephemeral=True, ) return @@ -418,7 +418,7 @@ async def last(self, interaction: discord.Interaction, user: discord.User | None if not countryball: msg = f"{'You do' if user is None else f'{user_obj.display_name} does'}" await interaction.followup.send( - f"{msg} not have any {settings.collectible_name}s yet.", + f"{msg} not have any {settings.plural_collectible_name} yet.", ephemeral=True, ) return @@ -460,7 +460,7 @@ async def favorite( if await player.balls.filter(favorite=True).count() >= settings.max_favorites: await interaction.response.send_message( f"You cannot set more than {settings.max_favorites} " - f"favorite {settings.collectible_name}s.", + f"favorite {settings.plural_collectible_name}.", ephemeral=True, ) return From b76e4a7b66983c3c4608d18332a2c9654d0520e9 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:37:26 +0300 Subject: [PATCH 08/14] changing to plural collectible name in config cog --- ballsdex/packages/config/cog.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ballsdex/packages/config/cog.py b/ballsdex/packages/config/cog.py index 008472b92..b96df2b8f 100644 --- a/ballsdex/packages/config/cog.py +++ b/ballsdex/packages/config/cog.py @@ -17,8 +17,8 @@ description=f"To enable {settings.bot_name} in your server, you must " f"read and accept the [Terms of Service]({settings.terms_of_service}).\n\n" "As a summary, these are the rules of the bot:\n" - f"- No farming (spamming or creating servers for {settings.collectible_name}s)\n" - f"- Selling or exchanging {settings.collectible_name}s " + f"- No farming (spamming or creating servers for {settings.plural_collectible_name})\n" + f"- Selling or exchanging {settings.plural_collectible_name} " "against money or other goods is forbidden\n" "- Do not attempt to abuse the bot's internals\n" "**Not respecting these rules will lead to a blacklist**", @@ -89,8 +89,8 @@ async def disable(self, interaction: discord.Interaction): self.bot.dispatch("ballsdex_settings_change", guild, enabled=False) await interaction.response.send_message( f"{settings.bot_name} is now disabled in this server. Commands will still be " - f"available, but the spawn of new {settings.collectible_name}s is suspended.\n" - "To re-enable the spawn, use the same command." + f"available, but the spawn of new {settings.plural_collectible_name}" + "is suspended.\nTo re-enable the spawn, use the same command." ) else: config.enabled = True # type: ignore @@ -100,7 +100,7 @@ async def disable(self, interaction: discord.Interaction): if channel: await interaction.response.send_message( f"{settings.bot_name} is now enabled in this server, " - f"{settings.collectible_name}s will start spawning " + f"{settings.plural_collectible_name} will start spawning " f"soon in {channel.mention}." ) else: From 55d324763e567fb16fe6f622449d4d041a364f41 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:39:16 +0300 Subject: [PATCH 09/14] changing to plural collectible name in info cog --- ballsdex/packages/info/cog.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ballsdex/packages/info/cog.py b/ballsdex/packages/info/cog.py index bb2c2e1f7..c698cc81b 100644 --- a/ballsdex/packages/info/cog.py +++ b/ballsdex/packages/info/cog.py @@ -114,9 +114,9 @@ async def about(self, interaction: discord.Interaction): f"{' '.join(str(x) for x in balls)}\n" f"{settings.about_description}\n" f"*Running version **[{ballsdex_version}]({settings.github_link}/releases)***\n\n" - f"**{balls_count:,}** {settings.collectible_name}s to collect\n" + f"**{balls_count:,}** {settings.plural_collectible_name} to collect\n" f"**{players_count:,}** players that caught " - f"**{balls_instances_count:,}** {settings.collectible_name}s\n" + f"**{balls_instances_count:,}** {settings.plural_collectible_name}\n" f"**{len(self.bot.guilds):,}** servers playing\n\n" f"{dex_credits}\n\n" "Consider supporting El Laggron on " From 43c95d378494dd1146875676bab004de21f0b580 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:42:30 +0300 Subject: [PATCH 10/14] changing to plural collectible name in trade cog --- ballsdex/packages/trade/cog.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ballsdex/packages/trade/cog.py b/ballsdex/packages/trade/cog.py index cb7438b25..acb6da89e 100644 --- a/ballsdex/packages/trade/cog.py +++ b/ballsdex/packages/trade/cog.py @@ -258,7 +258,7 @@ async def bulk_add( balls = await BallInstance.filter(**filters).prefetch_related("ball", "player") if not balls: await interaction.followup.send( - f"No {settings.collectible_name}s found.", ephemeral=True + f"No {settings.plural_collectible_name} found.", ephemeral=True ) return @@ -268,7 +268,7 @@ async def bulk_add( if len(balls) < 25: await interaction.followup.send( - f"You have less than 25 {settings.collectible_name}s, " + f"You have less than 25 {settings.plural_collectible_name}, " "you can use the add command instead.", ephemeral=True, ) @@ -276,10 +276,10 @@ async def bulk_add( view = BulkAddView(interaction, balls, self) # type: ignore await view.start( - content=f"Select the {settings.collectible_name}s you want to add to your proposal," - " note that the display will wipe on pagination however " - f"the selected {settings.collectible_name}s will remain.\n" - f"{settings.collectible_name.title()}s were rounded down to closest 25 for " + content=f"Select the {settings.plural_collectible_name} you want to add " + "to your proposal, note that the display will wipe on pagination however " + f"the selected {settings.plural_collectible_name} will remain.\n" + f"{settings.plural_collectible_name.title()} were rounded down to closest 25 for " "display purposes, final page may be missing entries." ) From ebeee2d3c5c9e29dbf8a1deaf4262df76fa3ad90 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Mon, 2 Sep 2024 23:47:15 +0300 Subject: [PATCH 11/14] making a line 2 lines for formatting checks to pass --- ballsdex/packages/trade/menu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ballsdex/packages/trade/menu.py b/ballsdex/packages/trade/menu.py index c4fa65da4..59033a827 100644 --- a/ballsdex/packages/trade/menu.py +++ b/ballsdex/packages/trade/menu.py @@ -455,7 +455,8 @@ async def confirm_button(self, interaction: discord.Interaction, button: Button) trader.proposal.append(ball) await ball.lock_for_trade() grammar = ( - f"{settings.collectible_name}" if len(self.balls_selected) == 1 + f"{settings.collectible_name}" + if len(self.balls_selected) == 1 else f"{settings.plural_collectible_name}" ) await interaction.followup.send( From f50bd241c78a71ee1e606357b8440a3ac59599e5 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Wed, 4 Sep 2024 21:49:25 +0300 Subject: [PATCH 12/14] ensuring correct grammar in a /balls favorite check --- ballsdex/packages/balls/cog.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ballsdex/packages/balls/cog.py b/ballsdex/packages/balls/cog.py index 9dcae1510..dcb7e8a3a 100644 --- a/ballsdex/packages/balls/cog.py +++ b/ballsdex/packages/balls/cog.py @@ -457,10 +457,14 @@ async def favorite( if not countryball.favorite: player = await Player.get(discord_id=interaction.user.id).prefetch_related("balls") + grammar = ( + f"{settings.collectible_name}" + if settings.max_favorites == 1 + else f"{settings.plural_collectible_name}" + ) if await player.balls.filter(favorite=True).count() >= settings.max_favorites: await interaction.response.send_message( - f"You cannot set more than {settings.max_favorites} " - f"favorite {settings.plural_collectible_name}.", + f"You cannot set more than {settings.max_favorites} favorite {grammar}.", ephemeral=True, ) return From 9bb372d4a9fd338ba3c15d59656d499c5943fd09 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Wed, 4 Sep 2024 22:07:02 +0300 Subject: [PATCH 13/14] added a check to /favorite if max favorites in settings is 0 --- ballsdex/packages/balls/cog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ballsdex/packages/balls/cog.py b/ballsdex/packages/balls/cog.py index dcb7e8a3a..85916eef7 100644 --- a/ballsdex/packages/balls/cog.py +++ b/ballsdex/packages/balls/cog.py @@ -455,6 +455,12 @@ async def favorite( if not countryball: return + if settings.max_favorites == 0: + await interaction.response.send_message( + f"You cannot set favorite {settings.plural_collectible_name} in this bot." + return + ) + if not countryball.favorite: player = await Player.get(discord_id=interaction.user.id).prefetch_related("balls") grammar = ( From f49f669cc286f75bb726b5fefad9561c44cd2896 Mon Sep 17 00:00:00 2001 From: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:29:38 +0300 Subject: [PATCH 14/14] small bug fix with return --- ballsdex/packages/balls/cog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballsdex/packages/balls/cog.py b/ballsdex/packages/balls/cog.py index 85916eef7..a03b28b6b 100644 --- a/ballsdex/packages/balls/cog.py +++ b/ballsdex/packages/balls/cog.py @@ -458,8 +458,8 @@ async def favorite( if settings.max_favorites == 0: await interaction.response.send_message( f"You cannot set favorite {settings.plural_collectible_name} in this bot." - return ) + return if not countryball.favorite: player = await Player.get(discord_id=interaction.user.id).prefetch_related("balls")