Skip to content

Commit 3917c0d

Browse files
committed
fix role id
1 parent dd9cf2c commit 3917c0d

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

src/DiscordHandler.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,24 @@ class DiscordHandler extends AbstractProcessingHandler
1818

1919
private $webhook;
2020
private $statement;
21+
private $roleId;
2122

22-
/**
23-
* MonologDiscordHandler constructor.
24-
* @param \GuzzleHttp\Client $guzzle
25-
* @param bool $webhooks
26-
* @param int $level
27-
* @param bool $bubble
28-
*/
29-
public function __construct($webhook, $name, $subname = '', $level = Logger::DEBUG, $bubble = true)
23+
/**
24+
* MonologDiscordHandler constructor.
25+
* @param $webhook
26+
* @param $name
27+
* @param string $subname
28+
* @param int $level
29+
* @param bool $bubble
30+
* @param null $roleId
31+
*/
32+
public function __construct($webhook, $name, $subname = '', $level = Logger::DEBUG, $bubble = true, $roleId =null)
3033
{
3134
$this->name = $name;
3235
$this->subname = $subname;
3336
$this->guzzle = new \GuzzleHttp\Client();
34-
$this->webhook = $webhook;
37+
$this->webhook = $webhook;
38+
$this->roleId = $roleId;
3539
parent::__construct($level, $bubble);
3640
}
3741

@@ -58,7 +62,7 @@ protected function write(array $record)
5862
];
5963

6064
// Tag a role if configured for it
61-
if(config('logging.discord.role_id')) $log['content'] = "<@&" . config('logging.discord.role_id') . ">";
65+
if($this->roleId) $log['content'] = "<@&" . $this->roleId . ">";
6266

6367

6468
// Send it to discord

src/DiscordLogger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DiscordLogger
1515
public function __invoke(array $config)
1616
{
1717
$log = new Logger('discord');
18-
$log->pushHandler(new DiscordHandler($config['webhook'], config('app.name'), null, $config['level'] ?? 'DEBUG'));
18+
$log->pushHandler(new DiscordHandler($config['webhook'], config('app.name'), null, $config['level'] ?? 'DEBUG'), $config['role_id'] ?? null);
1919

2020
return $log;
2121
}

0 commit comments

Comments
 (0)