Skip to content

Commit c573cff

Browse files
committed
- vk bots bugfix
1 parent b9bed97 commit c573cff

File tree

6 files changed

+15
-6
lines changed

6 files changed

+15
-6
lines changed

Botticelli.Framework.Telegram/TelegramBot.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@ public override async Task SetBotKey(string key, CancellationToken token)
434434

435435
public override async Task SetBotContext(BotContext context, CancellationToken token)
436436
{
437+
if (context == default) return;
438+
437439
var currentContext = _secureStorage.GetBotContext(BotDataUtils.GetBotId());
438440

439441
if (currentContext?.BotKey != context.BotKey)

Botticelli.Framework.Vk/VkBot.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected override async Task<StartBotResponse> InnerStartBotAsync(StartBotReque
7070
try
7171
{
7272
Logger.LogInformation($"{nameof(StartBotAsync)}...");
73-
var response = await base.StartBotAsync(request, token);
73+
var response = StartBotResponse.GetInstance(AdminCommandStatus.Ok, "");
7474

7575
if (IsStarted)
7676
{
@@ -112,6 +112,7 @@ protected override async Task<StartBotResponse> InnerStartBotAsync(StartBotReque
112112

113113
public override async Task SetBotContext(BotContext context, CancellationToken token)
114114
{
115+
if (context == default) return;
115116
var currentContext = _secureStorage.GetBotContext(BotDataUtils.GetBotId());
116117

117118
if (currentContext?.BotKey != context.BotKey)
@@ -183,7 +184,7 @@ protected override async Task<SendMessageResponse> InnerSendMessageAsync<TSendOp
183184
throw new BotException("Can't send a message!", ex);
184185
}
185186

186-
MessageSent.Invoke(this, new MessageSentBotEventArgs
187+
MessageSent?.Invoke(this, new MessageSentBotEventArgs
187188
{
188189
Message = request.Message
189190
});

VkAiChatGptSample/appsettings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"SecureStorageConnectionString": "Filename=database.db;Password=123;Connection=shared;"
1010
},
1111
"ServerSettings": {
12-
"ServerUri": "http://localhost:5050/v1/"
12+
"ServerUri": "http://localhost:53631/v1/"
13+
},
14+
"AnalyticsSettings": {
15+
"TargetUrl": "http://localhost:5251/v1/"
1316
},
1417
"ChatGptSettings": {
1518
"GenerateTokensLimit": 800,

VkMessagingSample/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
{
3131
s.Name = settings.BotName;
3232
s.PollIntervalMs = 100;
33-
s.GroupId = 221973506;
33+
s.GroupId = 222602273;
3434
}))
3535
.AddLogging(cfg => cfg.AddNLog())
3636
.AddHangfireScheduler(builder.Configuration)

VkMessagingSample/appsettings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"SecureStorageConnectionString": "Filename=database.db;Password=123;ReadOnly=false"
1010
},
1111
"ServerSettings": {
12-
"ServerUri": "http://localhost:5050/v1/"
12+
"ServerUri": "http://localhost:53631/v1/"
13+
},
14+
"AnalyticsSettings": {
15+
"TargetUrl": "http://localhost:5251/v1/"
1316
},
1417
"VkBotSettings": {
1518
"PollIntervalMs": 100,

0 commit comments

Comments
 (0)