diff --git a/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs b/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
index c6abde2..4da6df2 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Interfaces/CommandContext.cs
@@ -1,12 +1,13 @@
using LibMatrix.EventTypes.Spec;
using LibMatrix.Homeservers;
+using LibMatrix.Responses;
using LibMatrix.RoomTypes;
namespace LibMatrix.Utilities.Bot.Interfaces;
public class CommandContext {
public required GenericRoom Room { get; set; }
- public required StateEventResponse MessageEvent { get; set; }
+ public required MatrixEventResponse MessageEvent { get; set; }
public string MessageContentWithoutReply =>
(MessageEvent.TypedContent as RoomMessageEventContent)!
diff --git a/Utilities/LibMatrix.Utilities.Bot/Interfaces/RoomInviteContext.cs b/Utilities/LibMatrix.Utilities.Bot/Interfaces/RoomInviteContext.cs
index 380c1c7..c5ffc7c 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Interfaces/RoomInviteContext.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Interfaces/RoomInviteContext.cs
@@ -7,7 +7,7 @@ namespace LibMatrix.Utilities.Bot.Interfaces;
public class RoomInviteContext {
public required string RoomId { get; init; }
public required AuthenticatedHomeserverGeneric Homeserver { get; init; }
- public required StateEventResponse MemberEvent { get; init; }
+ public required MatrixEventResponse MemberEvent { get; init; }
public required SyncResponse.RoomsDataStructure.InvitedRoomDataStructure InviteData { get; init; }
public async Task<string> TryGetInviterNameAsync() {
diff --git a/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj b/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
index bbb0a65..80d43be 100644
--- a/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
+++ b/Utilities/LibMatrix.Utilities.Bot/LibMatrix.Utilities.Bot.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>net9.0</TargetFramework>
+ <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
@@ -9,12 +9,13 @@
<ItemGroup>
<ProjectReference Include="..\..\LibMatrix\LibMatrix.csproj"/>
+ <PackageReference Include="LibMatrix" Version="*-*" Condition="'$(ContinuousIntegrationBuild)'=='true'"/>
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1" />
- <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
- <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.1" />
+ <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0-rc.2.25502.107"/>
+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0-rc.2.25502.107"/>
+ <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0-rc.2.25502.107"/>
</ItemGroup>
diff --git a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
index 4c6b462..5b697de 100644
--- a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
+++ b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs
@@ -25,7 +25,7 @@ public class CommandListenerHostedService(
private FrozenSet<ICommand> _commands = null!;
private Task? _listenerTask;
- private CancellationTokenSource _cts = new();
+ private readonly CancellationTokenSource _cts = new();
private long _startupTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
/// <summary>Triggered when the application host is ready to start the service.</summary>
@@ -41,7 +41,7 @@ public class CommandListenerHostedService(
private async Task? Run(CancellationToken cancellationToken) {
logger.LogInformation("Starting command listener!");
- var filter = await hs.NamedCaches.FilterCache.GetOrSetValueAsync("gay.rory.libmatrix.utilities.bot.command_listener_syncfilter.dev3" + (config.SelfCommandsOnly),
+ var filter = await hs.NamedCaches.FilterCache.GetOrSetValueAsync("gay.rory.libmatrix.utilities.bot.command_listener_syncfilter.dev4" + (config.SelfCommandsOnly),
new SyncFilter() {
AccountData = new SyncFilter.EventFilter(notTypes: ["*"], limit: 1),
Presence = new SyncFilter.EventFilter(notTypes: ["*"]),
@@ -49,9 +49,11 @@ public class CommandListenerHostedService(
AccountData = new SyncFilter.RoomFilter.StateFilter(notTypes: ["*"]),
Ephemeral = new SyncFilter.RoomFilter.StateFilter(notTypes: ["*"]),
State = new SyncFilter.RoomFilter.StateFilter(notTypes: ["*"]),
- Timeline = new SyncFilter.RoomFilter.StateFilter(types: ["m.room.message"],
+ Timeline = new SyncFilter.RoomFilter.StateFilter(
+ types: ["m.room.message"],
notSenders: config.SelfCommandsOnly ? null : [hs.WhoAmI.UserId],
- senders: config.SelfCommandsOnly ? [hs.WhoAmI.UserId] : null
+ senders: config.SelfCommandsOnly ? [hs.WhoAmI.UserId] : null,
+ limit: config.SelfCommandsOnly ? 1 : null
),
}
});
@@ -61,7 +63,6 @@ public class CommandListenerHostedService(
Timeout = config.SyncConfiguration.Timeout ?? 30_000,
MinimumDelay = config.SyncConfiguration.MinimumSyncTime ?? TimeSpan.Zero,
SetPresence = config.SyncConfiguration.Presence ?? botConfig.Presence,
-
};
syncHelper.SyncReceivedHandlers.Add(async sync => {
@@ -118,7 +119,7 @@ public class CommandListenerHostedService(
await _cts.CancelAsync();
}
- private async Task<string?> GetUsedPrefix(StateEventResponse evt) {
+ private async Task<string?> GetUsedPrefix(MatrixEventResponse evt) {
var messageContent = evt.TypedContent as RoomMessageEventContent;
var message = messageContent!.BodyWithoutReplyFallback;
var prefix = config.Prefixes.OrderByDescending(x => x.Length).FirstOrDefault(message.StartsWith);
@@ -138,7 +139,7 @@ public class CommandListenerHostedService(
return prefix;
}
- private async Task<CommandResult> InvokeCommand(StateEventResponse evt, string usedPrefix) {
+ private async Task<CommandResult> InvokeCommand(MatrixEventResponse evt, string usedPrefix) {
var message = evt.TypedContent as RoomMessageEventContent;
var room = hs.GetRoom(evt.RoomId!);
diff --git a/Utilities/LibMatrix.Utilities.Bot/deps.json b/Utilities/LibMatrix.Utilities.Bot/deps.json
new file mode 100644
index 0000000..da8051b
--- /dev/null
+++ b/Utilities/LibMatrix.Utilities.Bot/deps.json
@@ -0,0 +1,142 @@
+[
+ {
+ "pname": "Microsoft.Extensions.Configuration",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-Bxb3LNyZsDlGyYxBjDnUIgj8ZfIDAb0fJqbBdGRocPY="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.Abstractions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-224s03xAtaxcp6T0D17a/aK2qGkPlajGS1THd6HXV8A="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.Binder",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-gPBNpr7vAB08NXWESFwt3G/b83ds/RDw17QN/op57kM="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.CommandLine",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-kZdKla41vPzV6XdCfz0ObTQW54Z4oVn17J5V8zouGa8="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.EnvironmentVariables",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-dNZaIOJ2TV9Chj9fIDshZTP8UbIvsCqEkQNv65iuX+8="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.FileExtensions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-X5e1bqK6OhslICJQQGA1HORX94rJBV1f3RMRZ4chwaE="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.Json",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-C6NixHkhPrNCX44U2KhJUlDbry1drXwKTKjTI5sDw5I="
+ },
+ {
+ "pname": "Microsoft.Extensions.Configuration.UserSecrets",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-tfmsy6K0UoSK0dh36XLypPm6cjJy0xyU9Pgm5YpKV+o="
+ },
+ {
+ "pname": "Microsoft.Extensions.DependencyInjection",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-LhtRtPoZbwgZrfaaFa2MNDK2TDsZby7T0UtlE2pqhwk="
+ },
+ {
+ "pname": "Microsoft.Extensions.DependencyInjection.Abstractions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-1nh8z2nglCizQkl0iWwJ/au4BAuuBu0xghKHGBeTM1I="
+ },
+ {
+ "pname": "Microsoft.Extensions.Diagnostics",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-LAKtLFZMBJ6qPp/h9rKbRCxk6lT2OsNQLqeKutIO5Go="
+ },
+ {
+ "pname": "Microsoft.Extensions.Diagnostics.Abstractions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-tLxHtLTe1KsvE00xgXlTfL4WrtURuzZyVT6hl5Kdx9g="
+ },
+ {
+ "pname": "Microsoft.Extensions.FileProviders.Abstractions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-UpNf7I8nhNDhEIIxZ3TD3EHJxBlAFLGB8qIrXvahZSQ="
+ },
+ {
+ "pname": "Microsoft.Extensions.FileProviders.Physical",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-WcY2e493OhzTx2YKUMpWZctrxmvPhW6pvB4zRPcRhBA="
+ },
+ {
+ "pname": "Microsoft.Extensions.FileSystemGlobbing",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-tgcgrmF89f+UZkBwdQEdEJlnJ+DnhPHM6E7zo5wfAdc="
+ },
+ {
+ "pname": "Microsoft.Extensions.Hosting",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-6psfqOUKyucgKUZx5sNtTFjiDPyXIDNatPWtTrqSz2I="
+ },
+ {
+ "pname": "Microsoft.Extensions.Hosting.Abstractions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-mPojrILhm+IhpZj8b0tGnosAxMorekKtC/6otju6qaI="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-HUDcfhht8zuN4g1Ku0YbUKQzM1tIv5qK9tUt1EWACFU="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging.Abstractions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-krml7WL+lF7oiYOvQ8NHQp7BVpHJrLIHhyxUgkHO+WE="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging.Configuration",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-nmwnKAorvZ49MurYaBBooxEpNZIbCtNcgYqZg83mS0M="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging.Console",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-+h4QtdYmFnXZ0ul7lYT/mq6ioidurFhN+neh413MWPU="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging.Debug",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-7imEDh57muZuPU0gqj4ZwbLwG7ElqC/M2vQNLE0m/kY="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging.EventLog",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-qWTH3yQ9OJdOC63gFR/j1kMWwwCphqmD4pOLEC00Ncg="
+ },
+ {
+ "pname": "Microsoft.Extensions.Logging.EventSource",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-3KkZT6gfLRHOcVb7GUvRC6os5JN5ftRT5Yyhz8XcjWA="
+ },
+ {
+ "pname": "Microsoft.Extensions.Options",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-0gis7GC+wzUJiWlP1EPi0vCrWDrV8sU6KHmt4WkI5bQ="
+ },
+ {
+ "pname": "Microsoft.Extensions.Options.ConfigurationExtensions",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-woY7sow2/WfzCN1K9IaJe1EtYuz/LZZhPvlU9b70Q+I="
+ },
+ {
+ "pname": "Microsoft.Extensions.Primitives",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-jvjZK/c8TGYIUA4zw7yR9uAFJmw90YE7TD3+DaxX9Ls="
+ },
+ {
+ "pname": "System.Diagnostics.EventLog",
+ "version": "10.0.0-rc.2.25502.107",
+ "hash": "sha256-WGW3a4boNTJcuPNKT0RH7G7K3HGatXqmmBIRIjHTKN4="
+ }
+]
|