{"id":17274390,"url":"https://github.com/new-dev0/switch-ts","last_synced_at":"2026-02-19T01:06:15.971Z","repository":{"id":255448509,"uuid":"850568778","full_name":"New-dev0/switch-ts","owner":"New-dev0","description":"Empower  bots and apps on Switch with our feature-rich TypeScript client library—seamlessly integrate, automate, and enhance your projects with ease.","archived":false,"fork":false,"pushed_at":"2024-12-01T16:21:57.000Z","size":52,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T20:36:22.048Z","etag":null,"topics":["switch","switch-communities"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/New-dev0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-09-01T06:38:46.000Z","updated_at":"2024-12-01T16:26:04.000Z","dependencies_parsed_at":"2024-09-05T12:56:36.611Z","dependency_job_id":"8d0a4874-55b0-439b-93bd-d7c84d6eae7d","html_url":"https://github.com/New-dev0/switch-ts","commit_stats":null,"previous_names":["new-dev0/switch-ts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/New-dev0%2Fswitch-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/New-dev0%2Fswitch-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/New-dev0%2Fswitch-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/New-dev0%2Fswitch-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/New-dev0","download_url":"https://codeload.github.com/New-dev0/switch-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852107,"owners_count":21171839,"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":["switch","switch-communities"],"created_at":"2024-10-15T08:53:49.437Z","updated_at":"2026-02-19T01:06:10.933Z","avatar_url":"https://github.com/New-dev0.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eSwitch SDK 🚀\u003c/h1\u003e\n  \u003cp\u003eA powerful TypeScript SDK for building bots and applications with Switch\u003c/p\u003e\n\n  ![npm version](https://img.shields.io/npm/v/switch-bots)\n  ![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)\n  ![License](https://img.shields.io/npm/l/switch-bots)\n  ![Downloads](https://img.shields.io/npm/dt/switch-bots)\n\u003c/div\u003e\n\n## 📚 Table of Contents\n- [Features](#-features)\n- [Installation](#-installation)\n- [Quick Start](#-quick-start)\n- [Examples](#-examples)\n- [API Reference](#-api-reference)\n- [Contributing](#-contributing)\n- [Support](#-support)\n\n## ✨ Features\n\n### Core Features\n- 🔥 **Full TypeScript Support** - Complete type definitions for all API methods\n- 🚀 **Promise-based API** - Modern async/await syntax\n- 🛡️ **Type Safety** - Catch errors before runtime\n- 📝 **Auto-completion** - IntelliSense support in VS Code and other IDEs\n\n### Platform Features\n- 💬 **Rich Messaging** - Text, media, buttons, and more\n- 👥 **Community Management** - Roles, permissions, and moderation\n- 🎮 **Game Integration** - Leaderboards and scoring\n- 🎨 **Sticker Support** - Create and manage sticker packs\n- 🔌 **WebSocket Support** - Real-time updates\n- 🔍 **Search Functionality** - Search messages, media, and users\n\n## 📦 Installation\n\n```bash\n# Using npm\nnpm install switch-bots\n\n# Using yarn\nyarn add switch-bots\n\n# Using pnpm\npnpm add switch-bots\n```\n\n## 🚀 Quick Start\n\n```typescript\nimport Client from 'switch-bots';\n\n// Initialize client\nconst client = new Client('YOUR_TOKEN');\n\n// Start receiving updates\nawait client.start();\n\n// Handle commands\nclient.onCommand(\"start\", async (message) =\u003e {\n    await message.replyText({\n        message: \"Welcome! 👋\",\n        inlineMarkup: new Button()\n            .url(\"Visit Website\", \"https://switch.pe\")\n            .callback(\"Get Started\", \"start_flow\")\n    });\n});\n\n// Handle messages\nclient.onMessage(async (message) =\u003e {\n    if (message.message.includes('hello')) {\n        await message.replyText({ \n            message: \"Hi there! How can I help?\" \n        });\n    }\n});\n```\n\n## 💡 Examples\n\n### Message Handling\n\n#### Send Rich Messages\n```typescript\n// Send message with buttons\nawait client.sendMessage({\n    message: \"Choose an option:\",\n    channelId: \"channel123\",\n    inlineMarkup: new Button()\n        .url(\"Website\", \"https://switch.pe\")\n        .callback(\"Click Me\", \"button_clicked\")\n});\n\n// Send media with caption\nawait client.sendMedia({\n    file: myFile,\n    caption: \"Check this out!\",\n    channelId: \"channel123\"\n});\n```\n\n#### Message Actions\n```typescript\n// Edit message\nawait message.editText({\n    message: \"Updated content\",\n    inlineMarkup: new Button().url(\"New Link\", \"https://example.com\")\n});\n\n// Pin message\nawait message.pin();\n\n// Add reaction\nawait message.addReaction(\"👍\");\n```\n\n### Community Management\n\n#### Role Management\n```typescript\n// Create role\nawait client.createRole(\"community123\", {\n    roleName: \"Moderator\",\n    roleColour: \"#FF0000\",\n    permissions: \"MODERATE\"\n});\n\n// Add member to role\nawait client.addMemberToRole({\n    communityId: \"community123\",\n    roleId: 1,\n    memberId: userId\n});\n```\n\n#### Moderation\n```typescript\n// Ban user\nawait client.banUser({\n    communityId: \"community123\",\n    userId: \"user123\"\n});\n\n// Restrict user\nawait client.restrictUser({\n    communityId: \"community123\",\n    userId: 123,\n    restricted: true,\n    restrictedTillTimestamp: someTimestamp\n});\n```\n\n## 📖 API Reference\n\n### Client Methods\n- [Message Methods](docs/messages.md)\n- [Community Methods](docs/community.md)\n- [Bot Methods](docs/bot.md)\n- [Media Methods](docs/media.md)\n- [Game Methods](docs/games.md)\n\n### Event Handlers\n- [Message Handler](docs/handlers.md#message)\n- [Command Handler](docs/handlers.md#command)\n- [Callback Handler](docs/handlers.md#callback)\n\n## 🛠️ Advanced Usage\n\n### Game Integration\n```typescript\n// Update leaderboard\nawait client.createLeaderboard({\n    userId: 123,\n    score: 1000,\n    level: 5,\n    communityId: \"community123\"\n});\n\n// Get rankings\nconst leaderboard = await client.getGlobalLeaderboard();\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing`)\n5. Open a Pull Request\n\n## 💬 Support\n- [Switch Community](https://switch.click/support)\n- [GitHub Issues](https://github.com/New-dev0/switch-ts)\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  Made with ❤️ by the Switch Team\n\u003c/div\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnew-dev0%2Fswitch-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnew-dev0%2Fswitch-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnew-dev0%2Fswitch-ts/lists"}