1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-26 05:38:48 +00:00
VpSharp/Samples/VpSharp.CSharp_Sample/Program.cs

39 lines
1.1 KiB
C#
Raw Normal View History

using VpSharp.Commands;
using VpSharp.EventData;
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 += 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}!");
}
}