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

34 lines
1.0 KiB
C#
Raw Normal View History

using VpSharp.Commands;
using VpSharp.Extensions;
2022-12-06 19:28:14 +00:00
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);
2022-12-06 19:52:31 +00:00
var commands = s_client.UseCommands(new CommandsExtensionConfiguration {Prefixes = new[] {"/"}});
commands.RegisterCommands<SayCommand>();
2022-12-06 19:28:14 +00:00
s_client.AvatarJoined.SubscribeAsync(async avatar => await s_client.SendMessageAsync($"Hello, {avatar.Name}!"));
2022-12-06 19:28:14 +00:00
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);
}
}