1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-14 16:45:41 +00:00
VpSharp/VpSharp.IntegrationTests/src/Program.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2022-11-27 15:36:56 +00:00
using VpSharp;
2022-11-27 20:43:21 +00:00
using VpSharp.Commands;
2022-11-27 15:36:56 +00:00
using VpSharp.Entities;
2022-11-27 20:43:21 +00:00
using VpSharp.IntegrationTests.CommandModules;
2022-11-27 15:36:56 +00:00
string? username = Environment.GetEnvironmentVariable("username");
string? password = Environment.GetEnvironmentVariable("password");
if (string.IsNullOrWhiteSpace(username))
{
Console.Error.WriteLine("username env variable cannot be empty");
return;
}
if (string.IsNullOrWhiteSpace(password))
{
Console.Error.WriteLine("password env variable cannot be empty");
return;
}
2022-11-27 20:43:21 +00:00
var configuration = new VirtualParadiseConfiguration
2022-11-27 15:36:56 +00:00
{
Username = username,
Password = password,
Application = new Application("VpSharp.IntegrationTests", "1.0.0"),
AutoQuery = false,
BotName = "TestBot"
};
using var client = new VirtualParadiseClient(configuration);
2022-11-27 20:43:21 +00:00
CommandsExtension commands = client.UseCommands(new CommandsExtensionConfiguration {Prefixes = new[] {"!"}});
commands.RegisterCommands<TestCommands>();
2022-11-27 15:36:56 +00:00
Console.WriteLine(@"Connecting to universe");
await client.ConnectAsync().ConfigureAwait(false);
Console.WriteLine(@"Logging in");
await client.LoginAsync();
Console.WriteLine(@"Entering world");
VirtualParadiseWorld world = await client.EnterAsync("Mutation");
Console.WriteLine(@"Entered world!");
VirtualParadiseAvatar avatar = client.CurrentAvatar!;
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);