mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-12 22:35:42 +00:00
feat: add AvatarJoined handler in integration test
This commit is contained in:
parent
9b6890b46f
commit
183261fedd
@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using VpSharp;
|
||||
using VpSharp.Commands;
|
||||
using VpSharp.Entities;
|
||||
@ -29,6 +30,8 @@ var configuration = new VirtualParadiseConfiguration
|
||||
};
|
||||
|
||||
using var client = new VirtualParadiseClient(configuration);
|
||||
client.AvatarJoined.SubscribeAsync(OnAvatarJoined);
|
||||
|
||||
CommandsExtension commands = client.UseCommands(new CommandsExtensionConfiguration { Prefixes = ["!"] });
|
||||
commands.RegisterCommands<TestCommands>();
|
||||
|
||||
@ -48,3 +51,11 @@ Console.WriteLine($@"My name is {avatar.Name} and I am at {avatar.Location}");
|
||||
Console.WriteLine($@"Entered {world.Name} with size {world.Size}");
|
||||
|
||||
await Task.Delay(-1);
|
||||
return;
|
||||
|
||||
[SuppressMessage("ReSharper", "AccessToDisposedClosure")]
|
||||
async Task OnAvatarJoined(VirtualParadiseAvatar av)
|
||||
{
|
||||
var user = await client.GetUserAsync(av.UserId);
|
||||
await client.SendMessageAsync($"Hello, {av.Name}. Your user is {user.Name} with ID {user.Id}");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user