{"id":20986578,"url":"https://github.com/nota30/eris-threads","last_synced_at":"2025-08-02T20:04:44.433Z","repository":{"id":57686096,"uuid":"491972993","full_name":"Nota30/eris-threads","owner":"Nota30","description":"A sharding and cluster manager for the eris discord package. Based on eris-sharder (just an updated version)","archived":false,"fork":false,"pushed_at":"2022-06-13T09:24:29.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-16T22:23:07.988Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Nota30.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}},"created_at":"2022-05-13T16:44:14.000Z","updated_at":"2024-02-13T02:02:39.000Z","dependencies_parsed_at":"2022-09-18T23:13:30.957Z","dependency_job_id":null,"html_url":"https://github.com/Nota30/eris-threads","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Nota30/eris-threads","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nota30%2Feris-threads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nota30%2Feris-threads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nota30%2Feris-threads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nota30%2Feris-threads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nota30","download_url":"https://codeload.github.com/Nota30/eris-threads/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nota30%2Feris-threads/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268448175,"owners_count":24251994,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-19T06:14:15.320Z","updated_at":"2025-08-02T20:04:44.389Z","avatar_url":"https://github.com/Nota30.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch4\u003e\u003cb\u003eeris-threads\u003c/b\u003e\u003c/h4\u003e\n  \u003cp\u003e\n\n\u003ca href=\"https://github.com/abalabahaha/eris\"\u003e\u003cimg src=\"https://img.shields.io/badge/Discord%20Library-Eris-blue?style=flat-square\" alt=\"Discord Library\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/eris-threads\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/eris-threads.svg?cacheSeconds=3600\u0026style=flat-square\u0026label=version\u0026logo=npm\" alt=\"NPM version\" /\u003e\u003c/a\u003e\n\n  \u003c/p\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://www.npmjs.com/package/eris-threads/\"\u003e\u003cimg src=\"https://nodei.co/npm/eris-threads.png?downloads=true\u0026stars=true\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n# About the package\n\nEris-threads is a sharding and cluster manager for discord bots based on [eris](https://abal.moe/Eris/). Eris-threads spreads shards evenly among your cores. Eris-threads is based on [eris-sharder](https://github.com/discordware/eris-sharder) (an updated version). **Supports CommonJS and ESM**.\n\n*You can find examples and usage [here](https://github.com/Nota30/eris-threads/tree/main/tests).*\n\n# Requirements\n- [Node.js version 16+](https://nodejs.org/en/)\n- [Eris version 0.17.0+](https://abal.moe/Eris/)\n\n# Installation\n\nnpm:\n\n```\nnpm install eris-threads eris\n```\n\nyarn:\n\n```\nyarn add eris-threads eris\n```\n\npnpm:\n\n```\npnpm add eris-threads eris\n```\n\n# Example\n\n## Directory Tree\n\nIn this example the directory tree will look something like this:\n\n```\nProject/\n├── node-modules/\n│   ├── eris-threads\n|\n├── main.js\n│\n├── index.js\n```\n\n## Example of index.js\n\n```javascript\nconst { ShardingManager } = require('eris-threads');\n\nconst shardManager = new ShardingManager({\n  mainFile: '/main.js',\n  token: 'botToken',\n  stats: true,\n  debug: true,\n  guildsPerShard: 1500,\n  webhooks: {\n    shard: {\n      id: 'webhookID',\n      token: 'webhookToken',\n      embed: {} // Custom embed if you wish\n    },\n    cluster: {\n      id: 'webhookID',\n      token: 'webhookToken',\n      embed: {}\n    },\n  },\n  clientOptions: {\n    messageLimit: 150,\n    defaultImageFormat: 'png',\n  },\n});\n\nshardManager.spawn();\n```\n\n## Example of main.js\n\n```javascript\nconst { Base } = require('eris-threads');\n\nclass Bot extends Base {\n  constructor(bot) {\n    super(bot);\n  }\n}\n\nmodule.exports = Bot;\n```\n\u003e You can start your bot using\n```\nnode index.js\n```\n\n## Sharding Manager Options\n\n| Name                     | Type      | Description                                                                                                                                                       |\n| ------------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `options.mainFile`         | `string`  | File path that exports the **Base** class. The class must containt a method called \"launch\". In the constructor the only paramater you should put is for the bot. |\n| `options.token`                  | `string`  | A discord bot  token                                                                                                                                                   |\n| `options.stats`          | `boolean` | Enables stats output if `true`.                                                                                                                                   |\n| `options.webhooks`       | `object`  | Webhook options to send to a channel. Example: `{shard: {id: \"webhookID\", token: \"webhookToken\"}, cluster:{id: \"webhookID\", token: \"webhookToken\"}}`              |\n| `options.clientOptions`  | `object`  | Eris client options. You can find them [here](https://abal.moe/Eris/docs/0.16.1/Client)                                                                           |\n| `options.clusters`       | `number`  | The number of clusters you want to spawn. Defaults to the amount of cores on your system                                                                          |\n| `options.clusterTimeout` | `number`  | Number of seconds between starting up clusters. Values lower than 5 may lead to an Invalid Session on first shard.                                                |\n| `options.shards`         | `number`  | The number of shards you want to spwan. Defaults gateway reccommendation, taking into account `options.guildsPerShard`                                            |\n| `options.firstShardID`   | `number`  | ID of the first shard to start on this instance. Defaults to `0`                                                                                                  |\n| `options.lastShardID`    | `number`  | ID of the last shard to start on this instance. Defaults to `options.shards - 1`                                                                                  |\n| `options.debug`          | `boolean` | Boolean to enable debug logging.                                                                                                                                  |\n| `options.noConsoleOveride`          | `boolean` | Boolean to disable or enable console overide. Default is `false`                                                                                                                                  |\n| `options.statsInterval`  | `number`  | Interval to release the stats event in milliseconds. Defaults to every minute                                                                                     |\n| `options.guildsPerShard` | `number`  | The number of guilds per shard. Defaults to 1300. Overriden if you only have 1 shard.                                                                             |\n\n# Base\n\nWhen you extend the Base class (main.js) you get access to `this.bot`, `this.clusterID`, and `this.ipc`\n\n\u003e `this.bot` is the eris client\n\n\u003e `this.clusterID` will return the cluster id.\n\n## IPC Methods\n| Name         | Example                                   | Description                                                                           |\n| ------------ | ----------------------------------------- | ------------------------------------------------------------------------------------- |\n| register     | `this.ipc.register(event, callback);`     | Using this you can register to listen for events and a callback that will handle them |\n| unregister   | `this.ipc.unregister(event);`             | Use this to unregister for an event                                                   |\n| broadcast    | `this.ipc.broadcast(name, message);`      | Using this you can send a custom message to every cluster                             |\n| sendTo       | `this.ipc.sendTo(cluster, name, message)` | Using this you can send a message to a specific cluster                               |\n| fetchUser    | `await this.ipc.fetchUser(id)`            | Using this you can search for a user by id on all clusters                            |\n| fetchGuild   | `await this.ipc.fetchGuild(id)`           | Using this you can search for a guild by id on all clusters                           |\n| fetchChannel | `await this.ipc.fetchChannel(id)`         | Using this you can search for a channel by id on all clusters                         |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnota30%2Feris-threads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnota30%2Feris-threads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnota30%2Feris-threads/lists"}