{"id":24701275,"url":"https://github.com/shipgirlproject/Kearsarge","last_synced_at":"2025-10-09T07:32:47.516Z","repository":{"id":184816646,"uuid":"672485210","full_name":"shipgirlproject/Kearsarge","owner":"shipgirlproject","description":"An alternative set of strategies for @discordjs/ws using CloudStorm","archived":false,"fork":false,"pushed_at":"2023-08-01T09:53:00.000Z","size":98,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T05:07:02.636Z","etag":null,"topics":["discord","discord-js","discordjs","websocket"],"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/shipgirlproject.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":"2023-07-30T08:44:33.000Z","updated_at":"2023-11-04T05:03:11.000Z","dependencies_parsed_at":"2024-09-29T06:16:30.922Z","dependency_job_id":null,"html_url":"https://github.com/shipgirlproject/Kearsarge","commit_stats":{"total_commits":41,"total_committers":2,"mean_commits":20.5,"dds":"0.024390243902439046","last_synced_commit":"7aa2a06cadbbb069684451036bb886e1b38c8001"},"previous_names":["deivu/kearsarge"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shipgirlproject%2FKearsarge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shipgirlproject%2FKearsarge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shipgirlproject%2FKearsarge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shipgirlproject%2FKearsarge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shipgirlproject","download_url":"https://codeload.github.com/shipgirlproject/Kearsarge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235801955,"owners_count":19047131,"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":["discord","discord-js","discordjs","websocket"],"created_at":"2025-01-27T05:07:09.089Z","updated_at":"2025-10-09T07:32:42.462Z","avatar_url":"https://github.com/shipgirlproject.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Kearsarge\n\n\u003e An alternative set of strategies for [@discordjs/ws](https://github.com/discordjs/discord.js/tree/main/packages/ws) using [CloudStorm](https://github.com/DasWolke/CloudStorm/tree/master)\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://safe.kashima.moe/315ktpr2490f.png\"\u003e \n\u003c/p\u003e\n\n\u003e The ShipGirl Project, feat Kearsarge; ⓒ Azur Lane\n\n### Notes\n\n* Uses mixed code between [@discordjs/ws](https://github.com/discordjs/discord.js/tree/main/packages/ws) and [CloudStorm](https://github.com/DasWolke/CloudStorm/tree/master)\n\n* Does not break anything in [@discordjs/ws](https://github.com/discordjs/discord.js/tree/main/packages/ws)\n\n* Implements both simple and worker sharding strategies of [@discordjs/ws](https://github.com/discordjs/discord.js/tree/main/packages/ws)\n\n* Has support for etf encoding and zlib compression (If you need those!)\n\n* Probably fast as well?\n\n### Installation\n\n* Stable Branch\n\u003e `npm i kearsarge --save`\n\n* Dev Branch\n\u003e `npm install https://github.com/Deivu/Kearsarge.git --save`\n\n### Example usages\n\n\u003e Using with Discord.JS with (Discord.JS default strategy)\n```js \nimport { KearsargeSimpleStrategy } from 'kearsarge';\nimport { GatewayIntentBits } from 'discord-api-types/v10';\nimport { Client } from 'discord.js';\n\nconst options = {\n    allowedMentions: { parse: [ 'users', 'roles' ] },\n    intents: [ Guilds ],\n    makeCache: Options.cacheWithLimits(Options.DefaultMakeCacheSettings),\n    ws: {\n        buildStrategy: (manager) =\u003e new KearsargeSimpleStrategy(manager)\n    }\n}\n\nconst client = new Client(options);\n\nawait client.login();\n```\n\n\u003e Using with Indomitable with enabled concurrency handling\n\n* Note: Don't use this if you don't use `handleConcurrency`. in those cases, use the discordjs strategies\n\n```js\nimport { IndomitableStrategy } from 'kearsarge';\nimport { Indomitable } from 'indomitable';\nimport { Client } from 'discord.js';\n\nconst options = {\n    clusterCount: 2,\n    shardCount: 8,\n    clientOptions: {\n        intents: [1 \u003c\u003c 0],\n        ws: {\n            buildStrategy: manager =\u003e new IndomitableStrategy(manager)\n        }\n    },\n    autoRestart: true,\n    handleConcurrency: true,\n    client: Client,\n    token: process.env.DISCORD_TOKEN\n}\n\nconst manager = new Indomitable(options)\n    .on('error', console.error);\n\nmanager.spawn();\n```\n\n\u003e Using simple strategy (Discord.JS default strategy)\n```js\nimport { KearsargeSimpleStrategy } from 'kearsarge';\nimport { WebSocketManager, WebSocketShardEvents } from '@discordjs/ws';\nimport { REST } from '@discordjs/rest';\n\nconst rest = new REST().setToken(process.env.DISCORD_TOKEN);\nconst manager = new WebSocketManager({\n    token: process.env.DISCORD_TOKEN,\n    intents: 0,\n    buildStrategy: (manager) =\u003e new KearsargeSimpleStrategy(manager),\n    rest\n});\n\nmanager.on(WebSocketShardEvents.Dispatch, (event) =\u003e console.log(event));\n\nawait manager.connect();\n```\n\n\u003e Using worker strategy\n```js\nimport { KearsargeWorkerStrategy } from 'kearsarge';\nimport { WebSocketManager, WebSocketShardEvents } from '@discordjs/ws';\nimport { REST } from '@discordjs/rest';\n\nconst rest = new REST().setToken(process.env.DISCORD_TOKEN);\nconst manager = new WebSocketManager({\n    token: process.env.DISCORD_TOKEN,\n    intents: 0,\n    buildStrategy: (manager) =\u003e new KearsargeWorkerStrategy(manager, { shardsPerWorker: 2 }),\n    rest\n});\n\nmanager.on(WebSocketShardEvents.Dispatch, (event) =\u003e console.log(event));\n\nawait manager.connect();\n```\n\n\u003e Use of different encoding with compression\n```js\nimport { KearsargeWorkerStrategy, WebsocketEncoding } from 'kearsarge';\nimport { CompressionMethod, WebSocketManager, WebSocketShardEvents } from '@discordjs/ws';\nimport { REST } from '@discordjs/rest';\n\nconst rest = new REST().setToken(process.env.DISCORD_TOKEN);\nconst manager = new WebSocketManager({\n    token: process.env.DISCORD_TOKEN,\n    // @ts-expect-error: overrides the type of discord.js encodings\n    encoding: WebsocketEncoding.ETF,\n    compression: CompressionMethod.ZlibStream,\n    intents: 0,\n    buildStrategy: (manager) =\u003e new KearsargeWorkerStrategy(manager, { shardsPerWorker: 2 }),\n    rest\n});\n```\n\n### Reminder\n\n* If you have custom strategies or bootstrappers, changing the WebsocketShard class to Kearsarge's websocket class will work. You don\\'t need to use any of my strategies if you have your own\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshipgirlproject%2FKearsarge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshipgirlproject%2FKearsarge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshipgirlproject%2FKearsarge/lists"}