1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-14 05:15:42 +00:00
VpSharp/Samples/VpSharp.VB_Sample/Program.vb

37 lines
1.2 KiB
VB.net

Imports VpSharp.Commands
Imports VpSharp.EventData
Module Program
Private WithEvents _client As VirtualParadiseClient
Public Sub Main(args As String())
MainAsync().GetAwaiter().GetResult()
End Sub
Private Async Function MainAsync() As Task
Dim configuration = new VirtualParadiseConfiguration _
With {
.Username = "YOUR_VP_USERNAME",
.Password = "YOUR_VP_PASSWORD",
.BotName = "Greeter",
.Application = New Application("GreeterBot", "1.0")
}
_client = New VirtualParadiseClient(configuration)
Dim commands = _client.UseCommands(New CommandsExtensionConfiguration With { .Prefixes = {"/"} })
commands.RegisterCommands(GetType(SayCommand))
Await _client.ConnectAsync()
Await _client.LoginAsync()
Await _client.EnterAsync("WORLD_NAME")
Await _client.CurrentAvatar.TeleportAsync(Vector3d.Zero)
Await Task.Delay(- 1)
End Function
Private Async Sub ClientOnAvatarJoined(sender As Object, args As AvatarJoinedEventArgs) Handles _client.AvatarJoined
Await _client.SendMessageAsync("Hello, " & args.Avatar.Name)
End Sub
End Module