Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚙ Rewrite configuration #54

Draft
wants to merge 8 commits into
base: beta
Choose a base branch
from
Draft

⚙ Rewrite configuration #54

wants to merge 8 commits into from

Conversation

ascpial
Copy link
Contributor

@ascpial ascpial commented Sep 10, 2022

Cette PR a pour but d'écrire un nouveau système de configuration pour être à la fois plus simple pour débuter et plus puissant avec une utilisation avancée.

Il est possible de voir la documentation concernant cette mise à jour à l'adresse suivante : https://gipsy.docs.gunivers.net/en/feat-config-ascpial/create_plugin/03-Global_configuration_variables.html

@ascpial ascpial marked this pull request as draft September 10, 2022 21:09
@ascpial
Copy link
Contributor Author

ascpial commented Sep 11, 2022

la syntaxe pour ajouter un vérificateur :

# le développeur de plugin peut aussi ajouter les champs en tant que variable
    class BanConfiguration(Configuration):
        friendly_ban = ConfigurationField(bool) # on pourra définir le type, avoir une conversion des données, mettre une valeur par défaut etc à terme

        @friendly_ban.check
        def friendly_ban(value): # on définie un validateur pour la valeur indiquée
            # le vérificateur pourra par exemple être un regex pour le token de bot, et autres choses du même genre
            # il n'y aura pas besoin de vérifier le type, puisque ça serait fait automatiquement
            if value is True:
                return False

je précise juste que ce n'est pas obligatoire d'utiliser cette syntaxe, il est tout à fait possible de faire par ex friendly_ban.check(lambda value: not value)

dans le cas d'un regex, il sera possible de faire :
token.check(config.regex_check('LE REGEX A VALIDER'))

si une validation échoue, il y aura un warning dans la console et on pourra récupérer un booléen pour vérifier si c'est bon ou non
je penses que ce n'est pas une bonne idée de faire crash le bot si la configuration est malformée, puisque dans certains cas quelqu'un pourrait avoir une bonne raison de donner une valeur invalide.

@ascpial ascpial changed the title feat(config): Réécriture de la configuration ⚙ feat(config): Réécriture de la configuration Oct 5, 2022
@ascpial ascpial force-pushed the feat-config-ascpial branch from 69d9f60 to 557fd97 Compare October 16, 2022 19:26
@ascpial ascpial closed this Oct 16, 2022
@ascpial ascpial deleted the feat-config-ascpial branch October 16, 2022 19:27
@ascpial ascpial restored the feat-config-ascpial branch October 16, 2022 19:28
@ascpial ascpial reopened this Oct 16, 2022
@ascpial ascpial changed the base branch from dev to rewrite October 16, 2022 19:30
@ascpial ascpial force-pushed the feat-config-ascpial branch from 557fd97 to 58e378e Compare October 24, 2022 19:08
@ascpial ascpial self-assigned this Nov 2, 2022
@ascpial ascpial force-pushed the feat-config-ascpial branch from a32d391 to 59e3c34 Compare February 16, 2023 08:23
@ascpial ascpial changed the base branch from rewrite to beta February 16, 2023 08:25
@ascpial
Copy link
Contributor Author

ascpial commented Feb 16, 2023

J'ai rebasé cette PR sur une version plus récente de beta et ai changé la branche cible.

@ascpial ascpial force-pushed the feat-config-ascpial branch from 59e3c34 to e7874cd Compare February 20, 2023 14:39
@ascpial ascpial changed the title ⚙ feat(config): Réécriture de la configuration ⚙ Rewrite configuration Feb 20, 2023
@Aeris1One Aeris1One added the refactor Request a code refactor label Feb 26, 2023
Aeris1One pushed a commit that referenced this pull request Apr 25, 2023
* feat(modlogs): add user badge logs

* refract(lint): fix relative imports

* feat(welcome): add `delete_welcome_on_quick_leave`

* fix(action): CodeQL triggers declaration

* feat(modlogs): show topic emoji in ticket creation

* feat(welcome): add more message variables

* fix(config): code using old table

* fix(modlogs): missing ID in member roles

* fix(modlogs): invite detection info

* fix(antiscam): linter

* fix(stats): antiscam enabled count

* feat(config): basic autocompletion

* refract(doc): sort server config options

* fix(rank): undefined style for card

* feat(info): add avatar command

* refract(lint): remove unusued imports

* feat(rss): better move feed selector

* refract(emojis): cleanup unicode fetching

* feat(config): emojis list autocomplete

* fix(errors): autocompletion issues

* refract(lint): better _() typing

* feat(config): add enums and bools translations

* feat(config): improve autocompletion

* fix(logs): invite detection log

* refract(bayes): slightly better var name

* feat(antiscam): better training results

* fix(tr): "finnish" translation in french

* fix(about): privacy policy url

* fix(stats): ignore kick action log search

* refract(ttt): player start random generator

* fix(url): http urls

* feat(config): levelup channel translation

* feat(xp): better error when closed DMs

* feat(doc): v4.3.2

* fix(antiscam): indentation replace

* refract(xp): db access methods

* fix(antiscam): better short-message filter

* feat(stats): add role reactions internal stats

* feat(slash): rank command conversion

* refract(lint): small improvement

* fix(config): timeout on config set cmd

* refract(translator): better missing tr handle

* fix(info): server with incorrect channels count

* feat(xp): new card generator

* feat(xp): better card generation

* fix(modlogs): role deletion logs

* refract(lint): serverconfig.py

* fix(antiscam): command invocation

* feat(tr): new guild features translations

* feat(xp): paginate top command

* feat(error): new RangeError message

* feat(doc): update top cmd doc

* feat(slash): migrate top command

* fix(mc): skin with invalid username

* feat(xp): new card generator

* feat(logs): add server update logs

* New Crowdin updates (#52)

* Update source file en.json

* Update source file en.json

* Update source file en.json

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* Update source file en.json

* Update source file en.json

* Update source file en.json

* Update source file en.json

* Update source file en.json

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)

* New translations en.json (LOLCAT)
@ascpial ascpial force-pushed the feat-config-ascpial branch from 9dc0513 to 4a3f093 Compare June 18, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Request a code refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants