Skip to content

Commit

Permalink
refact(sconfig): remove enable_ttt and replace enable_fun by enable_e…
Browse files Browse the repository at this point in the history
…vents
  • Loading branch information
ZRunner committed Jul 18, 2024
1 parent 0c34103 commit 1b40be4
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 29 deletions.
6 changes: 0 additions & 6 deletions core/checks/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ async def database_connected(ctx: MyContext | discord.Interaction[Axobot]) -> bo
return True
raise commands.CommandError("Database offline")

async def is_ttt_enabled(interaction: discord.Interaction[Axobot]) -> bool:
"Check if the tic-tac-toe game is enabled in a given context"
if interaction.guild is None:
return True
return await interaction.client.get_config(interaction.guild_id, "enable_ttt")

async def is_voice_message(interaction: discord.Interaction):
"Check if the message is a voice message"
if "resolved" not in interaction.data or "messages" not in interaction.data["resolved"]:
Expand Down
3 changes: 0 additions & 3 deletions docs/fun.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

This section of the bot contains lots of fun commands, which will be less useful than the other sections, but will add a good atmosphere in your server. Because a server's life is not just about moderation or utilities, Axobot couldn't be without a few moments of fun.

However, if too much fun bothers you, this option can be disabled at any time with the `config command <server.html>`__ (`enable_fun` parameter). The choice is yours!


---------------------
List of every command
---------------------
Expand Down
2 changes: 0 additions & 2 deletions docs/miscellaneous.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ Tic-tac-toe

Yes, we did it! A first mini-game for our bot, the tic-tac-toe! You can play against the bot in this fast and simplistic game, just by entering the command and clicking on empty cells.

.. note:: If you want to disable the game in your server, you can edit your "enable_ttt" `config option <server.html#list-of-every-option>`__


----
Poll
Expand Down
3 changes: 1 addition & 2 deletions docs/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ List of every option
* compress_help: Boolean indicating whether the full help message (without any specified command/module) should show every command or only their count
* delete_welcome_on_quick_leave: Boolean indicating whether the welcome message should be deleted if the member leaves the server quickly. Default is :code:`False`.
* description: Description of the server, used for the `info server <infos.html#info>`__ command and potential partners. Default empty.
* enable_fun: Boolean indicating if the fun part (documentation in preparation) is activated. If so, all commands in this section will be available. Default is :code:`True`.
* enable_ttt:Boolean indicating if members of your server can play tic-tac-toe. Default is :code:`True`.
* enable_events: Boolean indicating if the bot annual fun events (such as Halloween or Christmas celebrations) also take place on your server. Default is :code:`True`.
* enable_xp: Boolean indicating whether the xp system is activated. Default is :code:`True`.
* help_in_private: Boolean indicating whether the help command message should be sent as a private message or not. If the value is set to :code:`True`, the message will be sent in DM or as an ephemeral message.
* language: Language of the bot. Currently only the languages :code:`fr` (French), :code:`en` (English), :code:`fi` (Finnish) and :code:`de` (German) are available (also you can use :code:`lolcat` or :code:`fr2` for more fun). The change takes place as soon as the order is validated by the system. Default :code:`fr`.
Expand Down
4 changes: 0 additions & 4 deletions lang/help/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
"is_support_staff": [
"You are a member of the bot staff",
"You must be part of the bot staff"
],
"is_ttt_enabled": [
"The tic-tac-toe game is enabled",
"The tic-tac-toe game must be enabled on this server"
]
},
"cmd-count": {
Expand Down
4 changes: 0 additions & 4 deletions lang/help/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@
"is_support_staff": [
"Vous faites partie du staff du bot",
"Vous devez faire partie du staff du bot"
],
"is_ttt_enabled": [
"Le jeu du morpion est activé",
"Le jeu du morpion doit être activé sur ce serveur"
]
},
"cmd-count": {
Expand Down
3 changes: 1 addition & 2 deletions lang/server/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@
"compress_help": "Should the display of the `help` command be compressed? %{value}",
"delete_welcome_on_quick_leave": "Should I delete the welcome message when a member leaves right after joining? %{value}",
"description": "Server description:\n %{value}",
"enable_fun": "Are the commands listed in the `fun` command enabled? %{value}",
"enable_ttt": "Can members play tic-tac-toe in this server? %{value}",
"enable_events": "Should the bot's annual fun events (such as Halloween or Christmas celebrations) also take place on this server? %{value}",
"enable_xp": "Should the xp system be enabled? %{value}",
"help_in_private": "Send help message in private message? %{value}",
"hunter": "List of all chat rooms in which the game *Hunter* is active: %{value}",
Expand Down
3 changes: 1 addition & 2 deletions lang/server/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@
"compress_help": "L'affichage de la commande `help` doit-il être compressé ? %{value}",
"delete_welcome_on_quick_leave": "Supprimer le message de bienvenue lorsqu'un membre quitte le serveur juste après avoir rejoint ? %{value}",
"description": "Description du serveur :\n %{value}",
"enable_fun": "Les commandes répertoriées dans la commande `!fun` sont-elles activées ? %{value}",
"enable_ttt": "Les membres du serveur peuvent-ils jouer au morpion ? %{value}",
"enable_events": "Les événements amusants annuels du bot (tels que les célébrations d'Halloween ou de Noël) doivent-ils aussi avoir lieu dans ce serveur ? %{value}",
"enable_xp": "Le système d'xp doit-il être activé ? %{value}",
"help_in_private": "Envoyer le message d'aide en messages privés ? %{value}",
"hunter": "Liste des salons dans lesquels le jeu *Hunter* est actif : %{value}",
Expand Down
2 changes: 1 addition & 1 deletion modules/bot_events/subcogs/abstract_subcog.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async def is_fun_enabled(self, message: discord.Message):
return True
if not self.bot.database_online and not message.author.guild_permissions.manage_guild:
return False
return await self.bot.get_config(message.guild.id, "enable_fun")
return await self.bot.get_config(message.guild.id, "enable_events")

async def get_random_tip_field(self, interaction: discord.Interaction):
return {
Expand Down
2 changes: 1 addition & 1 deletion modules/fun/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def can_use_cookie(ctx: MyContext) -> bool:
return ctx.author.id in allowed_users

class Fun(commands.Cog):
"""Add some fun commands, no obvious use. You can disable this module with the 'enable_fun' option (command 'config')"""
"""Add some fun commands, no obvious use."""

def __init__(self, bot: Axobot):
self.bot = bot
Expand Down
2 changes: 0 additions & 2 deletions modules/tictactoe/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from discord.ext import commands

from core.bot_classes import Axobot
from core.checks.checks import is_ttt_enabled

GridType = list[int | Literal['X', 'O']]

Expand All @@ -21,7 +20,6 @@ def __init__(self, bot: Axobot):
self.in_game = {}

@app_commands.command(name="tic-tac-toe")
@app_commands.check(is_ttt_enabled)
async def main(self, interaction: discord.Interaction):
"""A simple mini-game that consists of aligning three chips on a 9-square grid.
The bot plays in red, the user in blue.
Expand Down

0 comments on commit 1b40be4

Please sign in to comment.