all repos — discord-utils @ b2c00f4dd362361aace8e4afc9baf28c31a0cb18

src/roblox/index.ts (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
export type RobloxUser = {
	username: string;
	displayName: string | null;
	id: string;
};

export async function getUser(id: string): Promise<RobloxUser> {
	const includeDisplayName = Math.random() < 0.5;

	return {
		username: "stub",
		displayName: includeDisplayName ? "stubDisplay" : null,
		id: id,
	};
}

export async function ban(
	id: string,
	universeId: string,
	options: {
		duration: string | undefined;
		excludeAltAccounts: boolean;
		displayReason: string;
		privateReason: string;
	},
): Promise<void> {
	const delay = Math.floor(Math.random() * 750) + 250;
	await new Promise((resolve) => setTimeout(resolve, delay));

	const chance = Math.random();
	if (chance < 0.3) throw new Error("Failed to ban user");
}