marvinlabs / laravel-discord-logger

Logging to a discord channel in Laravel
MIT License
176 stars 41 forks source link

Config file says "from.name" can be null, this is not true #8

Closed filliph closed 4 years ago

filliph commented 4 years ago
    /*
     * The author of the log messages. You can set both to null to keep the Webhook author set in Discord
     */
    'from'       => [
        'name'       => 'Error Logger',
        'avatar_url' => null,
    ],

Results in this error message:

   Symfony\Component\Debug\Exception\FatalThrowableError  : Return value of MarvinLabs\DiscordLogger\Converters\AbstractRecordConverter::getFromName() must be of the type string, null returned

  at /var/www/html/prod/vendor/marvinlabs/laravel-discord-logger/src/DiscordLogger/Converters/AbstractRecordConverter.php:98
     94|     }
     95| 
     96|     protected function getFromName(): string
     97|     {
  >  98|         return $this->config->get('discord-logger.from.name');
     99|     }
    100| 
    101|     protected function getFromAvatar(): ?string
    102|     {

  Exception trace:

  1   MarvinLabs\DiscordLogger\Converters\AbstractRecordConverter::getFromName()
      /var/www/html/prod/vendor/marvinlabs/laravel-discord-logger/src/DiscordLogger/Converters/AbstractRecordConverter.php:87

  2   MarvinLabs\DiscordLogger\Converters\AbstractRecordConverter::addGenericMessageFrom(Object(MarvinLabs\DiscordLogger\Discord\Message))
      /var/www/html/prod/vendor/marvinlabs/laravel-discord-logger/src/DiscordLogger/Converters/RichRecordConverter.php:19

I'm guessing it should be : ?string like the avatar?

vpratfr commented 4 years ago

Hi

That could be. Could you submit a PR and test it?

filliph commented 4 years ago

Done, confirmed it works with this change.