{"version":3,"file":"document.luau","names":[],"sources":["..\\..\\..\\src\\centurion\\commands\\document.ts"],"sourcesContent":["import { catcher, waitForDocument } from \"@lisachandra/core/utils/main\";\nimport { formatTable } from \"@lisachandra/core/utils/string\";\nimport type { CommandContext } from \"@rbxts/centurion\";\nimport { CenturionType, Command, Guard, Register } from \"@rbxts/centurion\";\nimport { Players } from \"@rbxts/services\";\n\nimport { adminOrDeveloper } from \"../guards\";\n\n@Register()\n/**\n * Admin command that retrieves document data for a specified player.\n *\n * @remarks\n *   On success the player is kicked (data is reloaded on rejoin). If the player is not in the\n *   server the document is unloaded asynchronously.\n */\nexport class DocumentCommand {\n\t@Command({\n\t\targuments: [\n\t\t\t{\n\t\t\t\ttype: CenturionType.Number,\n\t\t\t\tdescription: \"The user id of the player.\",\n\t\t\t\tname: \"user\",\n\t\t\t},\n\t\t],\n\t\tdescription: \"Get document information for a player.\",\n\t\tname: \"document\",\n\t})\n\t@Guard(adminOrDeveloper)\n\t/**\n\t * Fetches and displays the document associated with a user ID, then kicks the player or unloads\n\t * the document.\n\t *\n\t * @param context - The command context for replying with results.\n\t * @param userId - The Roblox user ID whose document to retrieve.\n\t */\n\tpublic document(context: CommandContext, userId: number): void {\n\t\twaitForDocument(userId)\n\t\t\t.then(async (document) => {\n\t\t\t\tconst data = document.get_data();\n\t\t\t\tcontext.reply(formatTable(data as Record<string, unknown>, \"Long\"));\n\n\t\t\t\tconst player = Players.GetPlayerByUserId(userId);\n\t\t\t\tif (player !== undefined) {\n\t\t\t\t\tplayer.Kick(\"Kicked by admin.\");\n\t\t\t\t} else {\n\t\t\t\t\ttask.defer(() => {\n\t\t\t\t\t\tdocument.unload();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(catcher());\n\t}\n}\n"],"mappings":";;AAAA;AAAA;AAAA;AACA;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AAEA;AAEA;AAAA;;;;;;;;;;;;;;AA6BE;AAAA;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;AAcF","ignoreList":[]}