Skip to content

Instantly share code, notes, and snippets.

@8chan-co
Created July 6, 2025 15:39
Show Gist options
  • Save 8chan-co/d8225e709cb801ed343453ddf74575c6 to your computer and use it in GitHub Desktop.
Save 8chan-co/d8225e709cb801ed343453ddf74575c6 to your computer and use it in GitHub Desktop.
using System.Net;
using System.Runtime.CompilerServices;
using Tests;
using VRChat.API.Api;
using VRChat.API.Client;
using VRChat.API.Model;
internal static class Program
{
private const string GroupName = "y2k";
private const int TargetDiscriminator = 2000;
private static async Task Main()
{
Configuration Configuration = new()
{
UserAgent = "I'm just a browser teeheehee",
};
Configuration.DefaultHeaders["Cookie"] = $"auth={Secrets.AuthenticationCookie}; twoFactorAuth={Secrets.TwoFactorAuthentication}";
ApiClient Client = new();
GroupsApi Groups = new(Client, Client, Configuration);
CreateGroupRequest Request = new(
name: GroupName,
shortCode: GroupName,
description: GroupName,
joinState: GroupJoinState.Invite,
iconId: "file_3fe96104-08d9-429d-9c61-e9f485d0c23e",
bannerId: "file_b2e30815-e9ad-46ba-a441-1efac1b9420e",
privacy: GroupPrivacy.Default,
roleTemplate: GroupRoleTemplate.ManagedInvite
);
while (true)
{
try
{
byte Interval = 0;
Group Group = await Groups.CreateGroupAsync(Request);
while (int.Parse(Group.Discriminator) is not TargetDiscriminator)
{
if (Interval++ is 9)
{
Interval = 0;
await Console.Out.WriteLineAsync(Group.Discriminator);
}
else
{
await Console.Out.WriteAsync($"{Group.Discriminator}; ");
}
await Sleep();
await Groups.DeleteGroupAsync(Group.Id);
await Sleep();
Group = await Groups.CreateGroupAsync(Request);
}
await Console.Out.WriteLineAsync($"{Group.ShortCode}.{Group.Discriminator}");
break;
}
catch (ApiException Exception)
{
HttpStatusCode StatusCode = Unsafe.BitCast<int, HttpStatusCode>(Exception.ErrorCode);
await Console.Out.WriteLineAsync($"{Exception.Message} ({StatusCode})");
if (StatusCode is HttpStatusCode.TooManyRequests)
{
await Task.Delay(TimeSpan.FromHours(1));
}
}
}
static async Task Sleep(int Min = 600_000, int Max = 1_200_000) =>
await Task.Delay(Random.Shared.Next(Min, Max + 1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment