1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-10 06:35:41 +00:00
VpSharp/Samples/VpSharp.CSharp_Sample/Program.cs

39 lines
1.1 KiB
C#

using VpSharp.Commands;
using VpSharp.EventData;
namespace VpSharp.CSharp_Sample;
internal static class Program
{
private static VirtualParadiseClient s_client = null!;
private static async Task Main()
{
var configuration = new VirtualParadiseConfiguration
{
Username = "YOUR_VP_USERNAME",
Password = "YOUR_VP_PASSWORD",
BotName = "Greeter",
Application = new Application("GreeterBot", "1.0")
};
s_client = new VirtualParadiseClient(configuration);
var commands = s_client.UseCommands(new CommandsExtensionConfiguration {Prefixes = {"/"}});
commands.RegisterCommands<SayCommand>();
s_client.AvatarJoined += ClientOnAvatarJoined;
await s_client.ConnectAsync();
await s_client.LoginAsync();
await s_client.EnterAsync("WORLD_NAME");
await s_client.CurrentAvatar!.TeleportAsync(Vector3d.Zero);
await Task.Delay(-1);
}
private static async void ClientOnAvatarJoined(object? sender, AvatarJoinedEventArgs args)
{
await s_client.SendMessageAsync($"Hello, {args.Avatar.Name}!");
}
}