veldtech / miki-bot

Miki Discord Bot
https://miki.bot
149 stars 48 forks source link

Localization changes, new service, refactoring #653

Closed velddev closed 4 years ago

velddev commented 4 years ago
  1. New settings service; this is currently untested, but I didn't want to make this commit any longer and start with a clean slate.

    ⚠️ this is a deploy blocking action however

  2. Miki.Localization got some buffs, I resolved some memory allocations and added iterative resource loading.

example

locale.GetString(
    new LanguageResource("miki_test_string", // contains "this is a {0}."
        new LanguageResource("entity_user")) // contains "user"

will return

this is a user.

without passing locale to either resource externally from Miki's side. This code has been tested 👍

  1. All {entity}NullExceptions have been replaced obsoleted in preference of EntityNullException<TEntity> to avoid boilerplate exceptions in the future.
velddev commented 4 years ago

Codacy Here is an overview of what got changed by this pull request:


Issues
======
+ Solved 3
- Added 3

Complexity increasing per file
==============================
- src/Miki/Services/Settings/SettingsService.cs  2
- src/Miki/Services/Settings/InvalidSettingException.cs  2
- src/Miki/Modules/Internal/Routines/DatadogService.cs  1

Complexity decreasing per file
==============================
+ src/Miki/Extensions/LocaleExtensions.cs  -3

Clones removed
==============
+ src/Miki/Modules/Pasta/PastaModule.cs  -1
+ src/Miki/Modules/MarriageModule.cs  -1

See the complete overview on Codacy