{"id":20733749,"url":"https://github.com/pageton/akinatorjs","last_synced_at":"2025-04-23T23:01:55.610Z","repository":{"id":250560148,"uuid":"834800579","full_name":"pageton/akinatorjs","owner":"pageton","description":"Akinator game library for Node.js","archived":false,"fork":false,"pushed_at":"2024-08-16T21:31:29.000Z","size":34,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T04:22:59.369Z","etag":null,"topics":["akinator","akinatorjs","game","games","javascript","npm","npm-package","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pageton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-28T12:02:05.000Z","updated_at":"2025-02-09T05:06:27.000Z","dependencies_parsed_at":"2024-08-16T22:54:09.601Z","dependency_job_id":null,"html_url":"https://github.com/pageton/akinatorjs","commit_stats":null,"previous_names":["dev-rio/akaintor","dev-rio/akinatorjs","pageton/akinatorjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageton%2Fakinatorjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageton%2Fakinatorjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageton%2Fakinatorjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageton%2Fakinatorjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pageton","download_url":"https://codeload.github.com/pageton/akinatorjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528731,"owners_count":21445516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["akinator","akinatorjs","game","games","javascript","npm","npm-package","typescript"],"created_at":"2024-11-17T05:26:53.963Z","updated_at":"2025-04-23T23:01:55.374Z","avatar_url":"https://github.com/pageton.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Akinator\n\nAkinator is a Node.js library for interacting with the Akinator web game. It allows you to play the Akinator game programmatically, answering questions and guessing the character.\n\n## Installation\n\nTo install the Akinator library, use [npm](https://www.npmjs.com/package/akinatorjs):\n\n```bash\nnpm install akinatorjs\n```\n\n## Usage\n\nTo use the Akinator library, import the `Akinator` class and create an instance:\n\n```javascript\nimport { Akinator, Language } from \"akinator\";\n\nconst akinator = new Akinator(Language.English);\n```\n\n### Starting a New Game\n\nTo start a new game, call the `startGame()` method:\n\n```javascript\nconst { ok, result } = await akinator.startGame();\nif (ok) {\n    console.log(`New game started! Current question: ${result.question}`);\n} else {\n    console.error(\"Error starting game:\", result.error);\n}\n```\n\n### Answering Questions\n\nTo answer a question, use the `answerQuestion()` method:\n\n```javascript\nconst { ok, result } = await akinator.answerQuestion(\"y\", akinator.id);\nif (ok) {\n    console.log(\n        `Current progress: ${result.progress}, Current question: ${result.question}`\n    );\n} else {\n    console.error(\"Error answering question:\", result.error);\n}\n```\n\nThe `answerQuestion()` method takes the answer as the first argument and the game ID as the second argument.\n\n### Going Back\n\nTo go back to the previous question, use the `back()` method:\n\n```javascript\nconst { ok, result } = await akinator.back(akinator.id);\nif (ok) {\n    console.log(\n        `Went back, current progress: ${result.progress}, current question: ${result.question}`\n    );\n} else {\n    console.error(\"Error going back:\", result.error);\n}\n```\n\n### Handling the Result\n\nWhen the Akinator game is finished, the `answerQuestion()` method will return the result:\n\n```javascript\nconst { ok, result } = await akinator.answerQuestion(\"y\", akinator.id);\nif (ok \u0026\u0026 result.photo) {\n    console.log(`Akinator guessed: ${result.name}`);\n    console.log(`Description: ${result.description}`);\n    console.log(`Photo: ${result.photo}`);\n} else {\n    console.error(\"Error getting result:\", result.error);\n}\n```\n\n## License\n\nThis project is licensed under the MIT License.\n\n## Contributing\n\nIf you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpageton%2Fakinatorjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpageton%2Fakinatorjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpageton%2Fakinatorjs/lists"}