Skip to content

Commit a50d699

Browse files
author
Igor Evdokimov
committed
- cleanup
1 parent 875b397 commit a50d699

File tree

23 files changed

+48
-213
lines changed

23 files changed

+48
-213
lines changed

Botticelli.Analytics.Shared/Metrics/IMetricObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public interface IMetricObject
44
{
55
string Id { get; }
6-
string BotId { get; set; }
6+
string? BotId { get; set; }
77
DateTime Timestamp { get; set; }
88
string Name { get; set; }
99
Dictionary<string, string>? AdditionalParameters { get; set; }

Botticelli.Analytics.Shared/Metrics/UserDefinedMetricObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class MetricObject : IMetricObject
44
{
55
public string Id => Guid.NewGuid().ToString();
6-
public required string BotId { get; set; }
6+
public required string? BotId { get; set; }
77
public DateTime Timestamp { get; set; }
88
public virtual required string Name { get; set; }
99
public Dictionary<string, string>? AdditionalParameters { get; set; }

Botticelli.Bot.Data.Entities/Bot/BotData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ public class BotData
1212
public BotStatus? Status { get; set; }
1313
public BotType? Type { get; set; }
1414
public string? BotKey { get; set; }
15-
public List<BotAdditionalInfo> AdditionalInfo { get; set; }
15+
public List<BotAdditionalInfo>? AdditionalInfo { get; set; }
1616
}

Botticelli.Client.Analytics/MetricsProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class MetricsProcessor
99

1010
public MetricsProcessor(MetricsPublisher publisher) => _publisher = publisher;
1111

12-
public void Process(string name, string botId)
12+
public void Process(string name, string? botId)
1313
=> Task.Run(() => _publisher.Publish(new MetricObject
1414
{
1515
Name = name,

Botticelli.Framework.Monads/Commands/Processors/OutputCommandProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class OutputCommandProcessor<TReplyMarkup, TCommand> : ChainProcessor<TCo
1212
where TReplyMarkup : class
1313
where TCommand : IChainCommand
1414
{
15-
private readonly SendOptionsBuilder<TReplyMarkup>? _options;
15+
private readonly SendOptionsBuilder<TReplyMarkup> _options;
1616

1717
public OutputCommandProcessor(ILogger<OutputCommandProcessor<TReplyMarkup, TCommand>> logger,
1818
ILayoutSupplier<TReplyMarkup> layoutSupplier,

Botticelli.Framework.Telegram/TelegramBot.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public TelegramBot(ITelegramBotClient client,
5454
public override event MsgSentEventHandler? MessageSent;
5555
public override event MsgReceivedEventHandler? MessageReceived;
5656
public override event MsgRemovedEventHandler? MessageRemoved;
57-
public override event MessengerSpecificEventHandler? MessengerSpecificEvent;
57+
public event MessengerSpecificEventHandler? MessengerSpecificEvent;
5858

5959
/// <summary>
6060
/// Deletes a message
@@ -119,7 +119,7 @@ await _client.DeleteMessageAsync(request.ChatId,
119119
/// <exception cref="BotException"></exception>
120120
/// <exception cref="ArgumentOutOfRangeException"></exception>
121121
protected override async Task<SendMessageResponse> InnerSendMessageAsync<TSendOptions>(SendMessageRequest request,
122-
ISendOptionsBuilder<TSendOptions>? optionsBuilder,
122+
ISendOptionsBuilder<TSendOptions> optionsBuilder,
123123
bool isUpdate,
124124
CancellationToken token)
125125
{

Botticelli.Framework.Vk/VkBot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private string CreateVkAttach(VkSendVideoResponse fk, string type)
167167

168168

169169
protected override async Task<SendMessageResponse> InnerSendMessageAsync<TSendOptions>(SendMessageRequest request,
170-
ISendOptionsBuilder<TSendOptions>? optionsBuilder,
170+
ISendOptionsBuilder<TSendOptions> optionsBuilder,
171171
bool isUpdate,
172172
CancellationToken token)
173173
{
@@ -181,7 +181,7 @@ protected override async Task<SendMessageResponse> InnerSendMessageAsync<TSendOp
181181
foreach (var vkRequest in requests)
182182
await _messagePublisher.SendAsync(vkRequest, token);
183183
}
184-
catch (Exception ex)
184+
catch (Exception? ex)
185185
{
186186
throw new BotException("Can't send a message!", ex);
187187
}
@@ -312,5 +312,5 @@ public override Task<RemoveMessageResponse> DeleteMessageAsync(RemoveMessageRequ
312312
public override event MsgSentEventHandler MessageSent;
313313
public override event MsgReceivedEventHandler MessageReceived;
314314
public override event MsgRemovedEventHandler MessageRemoved;
315-
public override event MessengerSpecificEventHandler MessengerSpecificEvent;
315+
public virtual event MessengerSpecificEventHandler MessengerSpecificEvent;
316316
}

Botticelli.Framework/BaseBot.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using Botticelli.Shared.API.Client.Requests;
1212
using Botticelli.Shared.API.Client.Responses;
1313
using Botticelli.Shared.Constants;
14-
using Botticelli.Shared.ValueObjects;
1514
using Microsoft.Extensions.Logging;
1615

1716
namespace Botticelli.Framework;
@@ -31,9 +30,9 @@ public abstract class BaseBot
3130

3231
public delegate void StoppedEventHandler(object sender, StoppedBotEventArgs e);
3332

34-
public virtual event MsgSentEventHandler MessageSent;
35-
public virtual event MsgReceivedEventHandler MessageReceived;
36-
public virtual event MsgRemovedEventHandler MessageRemoved;
33+
public virtual event MsgSentEventHandler? MessageSent;
34+
public virtual event MsgReceivedEventHandler? MessageReceived;
35+
public virtual event MsgRemovedEventHandler? MessageRemoved;
3736
}
3837

3938
/// <summary>
@@ -102,7 +101,7 @@ public Task<SendMessageResponse> SendMessageAsync(SendMessageRequest request, Ca
102101
/// <param name="token"></param>
103102
/// <returns></returns>
104103
public virtual async Task<SendMessageResponse> SendMessageAsync<TSendOptions>(SendMessageRequest request,
105-
ISendOptionsBuilder<TSendOptions>? optionsBuilder,
104+
ISendOptionsBuilder<TSendOptions> optionsBuilder,
106105
CancellationToken token)
107106
where TSendOptions : class
108107
{
@@ -117,7 +116,7 @@ public virtual async Task<SendMessageResponse> SendMessageAsync<TSendOptions>(Se
117116
public Task<SendMessageResponse> UpdateMessageAsync(SendMessageRequest request, CancellationToken token)
118117
=> SendMessageAsync<object>(request, null, token);
119118

120-
public async Task<SendMessageResponse> UpdateMessageAsync<TSendOptions>(SendMessageRequest request, ISendOptionsBuilder<TSendOptions>? optionsBuilder, CancellationToken token)
119+
public async Task<SendMessageResponse> UpdateMessageAsync<TSendOptions>(SendMessageRequest request, ISendOptionsBuilder<TSendOptions> optionsBuilder, CancellationToken token)
121120
where TSendOptions : class
122121
{
123122
_metrics.Process(MetricNames.MessageSent, BotDataUtils.GetBotId());
@@ -144,15 +143,14 @@ public virtual async Task<RemoveMessageResponse> DeleteMessageAsync(RemoveMessag
144143
protected abstract Task<StopBotResponse> InnerStopBotAsync(StopBotRequest request, CancellationToken token);
145144

146145
protected abstract Task<SendMessageResponse> InnerSendMessageAsync<TSendOptions>(SendMessageRequest request,
147-
ISendOptionsBuilder<TSendOptions>? optionsBuilder,
146+
ISendOptionsBuilder<TSendOptions> optionsBuilder,
148147
bool isUpdate,
149148
CancellationToken token)
150149
where TSendOptions : class;
151150

152151
protected abstract Task<RemoveMessageResponse> InnerDeleteMessageAsync(RemoveMessageRequest request,
153152
CancellationToken token);
154153

155-
public virtual event MessengerSpecificEventHandler MessengerSpecificEvent;
156154
public event StartedEventHandler Started;
157155
public event StoppedEventHandler Stopped;
158156
}

Botticelli.Framework/BotStatusService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private void GetRequiredStatus(CancellationToken cancellationToken)
7777
if (taskResult == default)
7878
throw new BotException("No result from server!");
7979

80-
var botContext = taskResult?.BotContext;
80+
var botContext = taskResult.BotContext;
8181
if (botContext == default)
8282
throw new BotException("No bot context from server!");
8383

@@ -88,7 +88,7 @@ private void GetRequiredStatus(CancellationToken cancellationToken)
8888
BotKey = botContext.BotKey,
8989
AdditionalInfo = botContext.Items?.Select(it => new BotAdditionalInfo
9090
{
91-
BotId = taskResult.BotId,
91+
BotId = taskResult!.BotId,
9292
ItemName = it.Key,
9393
ItemValue = it.Value
9494
})

Botticelli.Framework/Constants/Currencies.cs

Lines changed: 0 additions & 161 deletions
This file was deleted.

0 commit comments

Comments
 (0)