mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
Properly register command statistics
This commit is contained in:
parent
5fc654b758
commit
7b55abaacd
1 changed files with 5 additions and 1 deletions
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using App.Metrics;
|
||||
|
||||
using Discord;
|
||||
using Discord.Net;
|
||||
using Discord.WebSocket;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -19,6 +20,7 @@ namespace PluralKit.Bot.CommandSystem
|
|||
|
||||
private readonly IDataStore _data;
|
||||
private readonly PKSystem _senderSystem;
|
||||
private readonly IMetrics _metrics;
|
||||
|
||||
private Command _currentCommand;
|
||||
|
||||
|
|
@ -29,6 +31,7 @@ namespace PluralKit.Bot.CommandSystem
|
|||
_message = message;
|
||||
_data = provider.GetRequiredService<IDataStore>();
|
||||
_senderSystem = senderSystem;
|
||||
_metrics = provider.GetRequiredService<IMetrics>();
|
||||
_provider = provider;
|
||||
_parameters = new Parameters(message.Content.Substring(commandParseOffset));
|
||||
}
|
||||
|
|
@ -75,6 +78,7 @@ namespace PluralKit.Bot.CommandSystem
|
|||
try
|
||||
{
|
||||
await handler(_provider.GetRequiredService<T>());
|
||||
_metrics.Measure.Meter.Mark(BotMetrics.CommandsRun);
|
||||
}
|
||||
catch (PKSyntaxError e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue