static async Task Main(string[] args) { VRChatApi.VRChatApi api = new VRChatApi.VRChatApi("avail", ""); // remote config ConfigResponse config = await api.RemoteConfig.Get(); // user api UserResponse user = await api.UserApi.Login(); //UserResponse userNew = await api.UserApi.Register("someName", "somePassword", "*****@*****.**"); //UserResponse userUpdated = await api.UserApi.UpdateInfo(user.id, null, null, null, new List<string>() { "admin_moderator", "admin_scripting_access", "system_avatar_access", "system_world_access" }); // friends //List<UserBriefResponse> friends = await api.FriendsApi.Get(0, 20, true); //NotificationResponse friendRequestResponse = await api.FriendsApi.SendRequest("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685", api.UserApi.Username); //string friendDeletionResponse = await api.FriendsApi.DeleteFriend("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685"); //await api.FriendsApi.AcceptFriend("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685"); // world api WorldResponse world = await api.WorldApi.Get("wrld_b2d24c29-1ded-4990-a90d-dd6dcc440300"); //List<WorldBriefResponse> starWorlds = await api.WorldApi.Search(WorldGroups.Favorite, count: 4); //List<WorldBriefResponse> scaryWorlds = await api.WorldApi.Search(keyword: "Scary", sort: SortOptions.Popularity); //List<WorldBriefResponse> featuredWorlds = await api.WorldApi.Search(featured: true); //WorldMetadataResponse metadata = await api.WorldApi.GetMetadata("wrld_b2d24c29-1ded-4990-a90d-dd6dcc440300"); /*if (world.instances.Count > 0) * { * WorldInstanceResponse worldInst = await api.WorldApi.GetInstance(world.id, world.instances[0].id); * }*/ }
public static async Task Login(string username, string password) { api = new VRChatApi.VRChatApi(username, password); ownPlayer = await api.UserApi.Login(); /* * if (string.IsNullOrEmpty(ownPlayer.displayName)) return false; * return true; */ }
static async Task Main(string[] args) { VRChatApi.VRChatApi api = new VRChatApi.VRChatApi("username", "password"); VRChatApi.Logging.LogProvider.SetCurrentLogProvider(new ColoredConsoleLogProvider()); // remote config ConfigResponse config = await api.RemoteConfig.Get(); // user api //UserResponse userNew = await api.UserApi.Register("someName", "somePassword", "*****@*****.**"); UserResponse user = await api.UserApi.Login(); //UserResponse userUpdated = await api.UserApi.UpdateInfo(user.id, null, null, null, new List<string>() { "admin_moderator", "admin_scripting_access", "system_avatar_access", "system_world_access" }); // friends //List<UserBriefResponse> friends = await api.FriendsApi.Get(0, 20, true); //NotificationResponse friendRequestResponse = await api.FriendsApi.SendRequest("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685", api.UserApi.Username); //string friendDeletionResponse = await api.FriendsApi.DeleteFriend("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685"); //await api.FriendsApi.AcceptFriend("usr_f8220fc0-e6f9-45ab-8d9f-ae00e8491685"); // world api var worldId = "wrld_b2d24c29-1ded-4990-a90d-dd6dcc440300"; // The great Pug WorldResponse world = await api.WorldApi.Get(worldId); //List<WorldBriefResponse> starWorlds = await api.WorldApi.Search(WorldGroups.Favorite, count: 4); List <WorldBriefResponse> scaryWorlds = await api.WorldApi.Search(keyword : "Scary", sort : SortOptions.Popularity); List <WorldBriefResponse> featuredWorlds = await api.WorldApi.Search(featured : true); WorldMetadataResponse metadata = await api.WorldApi.GetMetadata(worldId); var instances = new List <WorldInstanceResponse>(); if (world.instances.Count > 0) { foreach (WorldInstance instance in world.instances) { WorldInstanceResponse worldInst = await api.WorldApi.GetInstance(world.id, instance.id); instances.Add(worldInst); } } // avatar api AvatarResponse avatar = await api.AvatarApi.GetById("avtr_17036f54-f706-46bf-8a43-0c60564123ff"); }
async Task StartApi() { if (IsLoggedIn) { return; } string n = Environment.NewLine; string userID = ""; try { Global.ApiKey = apiKeyTextField.Text; try { System.IO.File.WriteAllLines("APIKey.cfg", new string[] { Global.ApiKey }); } catch (Exception e) { /*unhandled*/ } logTextField.Text += "Logging in to API as " + userTextField.Text + n; //logTextField.Text += "Creating API Instance" + n; api = new VRChatApi.VRChatApi(userTextField.Text, passwordTextField.Text); //logTextField.Text += "Getting config response" + n; ConfigResponse config = await api.RemoteConfig.Get(); UserResponse user = await api.UserApi.Login(); if (user == null) { logTextField.Text += "Login Failed (Incorrect Username/Password OR APIKey)" + n; IsLoggedIn = false; return; } loginButton.Enabled = false; //logTextField.Text += user.DeepDumpAsString() + n; IsLoggedIn = true; userID = user.id; if (!user.friends.Contains(userID)) { await api.UserApi.SendFriendRequest(userID); await api.FriendsApi.AcceptFriend(userID); } } catch (Exception e) { logTextField.Text += e.ToString() + Environment.NewLine; } new Thread(async() => { while (true) { if (!IsLoggedIn) { break; } if (!loggingOnButton.Checked) { Thread.Sleep(1000); continue; } //usr_80a984c9-2b8e-4396-b893-2f31d8fd2ba3 UserBriefResponse userPing = await api.UserApi.GetById(userID); //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "User Ping" + n + n + userPing.DeepDumpAsString() + n); ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "Running check for stolen avatars" + n); IList <String> ids = await api.WorldApi.GetUsersInInstance(userPing.worldId + "/" + userPing.instanceId); foreach (String s in ids) { //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + s + n); UserBriefResponse userInRoom = await api.UserApi.GetById(s); if (userInRoom == null) { continue; } IList <string> userPublicAvatars = await api.AvatarApi.GetAvatarList(userInRoom.id); foreach (String ss in userPublicAvatars) { //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + " " + ss + n); try { AvatarResponse avatar = await api.AvatarApi.GetById(ss); CheckIfStolen(avatar.assetUrl, avatar.id, userInRoom.username, userInRoom.displayName, userInRoom.id); } catch (Exception e) { string response = await api.AvatarApi.GetUrl(ss); string[] parse = response.Split('"'); string assetURL = ""; string avatarID = ""; for (int i = 0; i < parse.Length; i++) { if (parse[i].Contains("assetUrl")) { assetURL = parse[i + 2]; break; } } foreach (String sss in parse) { if (sss.Contains("avtr_")) { avatarID = sss; break; } } CheckIfStolen(assetURL, avatarID, userInRoom.username, userInRoom.displayName, userInRoom.id); //ThreadHelperClass.SetText(this, logTextField, logTextField.Text + " " + "Manual Asset URL: " + assetURL + n); } } } ThreadHelperClass.SetText(this, logTextField, logTextField.Text + "Check finished. Waiting 60 seconds..." + n); Thread.Sleep(60000); } }).Start(); }
async void OnButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(userid.Text) && !string.IsNullOrWhiteSpace(passid.Text)) { try { ActivityIndicator2.IsRunning = true; Device.StartTimer(TimeSpan.FromSeconds(5), () => { ActivityIndicator2.IsRunning = false; return(false); }); VRChatApi.VRChatApi api = new VRChatApi.VRChatApi(userid.Text, passid.Text); ConfigResponse config = await api.RemoteConfig.Get(); UserResponse users = await api.UserApi.Login(); var app = Application.Current as App; if (set == true) { app.Title = userid.Text; app.pass = passid.Text; } app.nitmod = nightmode.IsToggled; try { if (users.state != null) { var TabbedPage6 = new MainTabbed(userid.Text, passid.Text, nightmodeset); await Navigation.PushAsync(TabbedPage6); } else if (users.error.status_code != null) { var answer = DisplayAlert(users.error.status_code + "ERRER", users.error.message, "ok"); } //string.IsNullOrEmpty(users.requiresTwoFactorAuth[0]) } catch { } try { if (users.requiresTwoFactorAuth[0] != null) { UserResponse otpset = await api.UserApi.TOTPLogin(motp.Text); if (otpset.verified == false) { var answer = DisplayAlert("2FA", " wrong otp number", "ok"); await api.UserApi.Logout(); } else { var TabbedPage6 = new MainTabbed(userid.Text, passid.Text, nightmodeset); await Navigation.PushAsync(TabbedPage6); } } } catch { } } catch { var answer = DisplayAlert("NETWORK ERRER", "Please check the device connection status", "ok"); } } }