MCPcopy Index your code
hub / github.com/countr/countr

github.com/countr/countr @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
245 symbols 656 edges 185 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Docker test Linting Testing DeepScan grade discord.js version GitHub Issues GitHub Pull Requests

Countr

Countr is an advanced counting bot which can manage a counting channel in your guild. With a simple setup, your channel is ready.

Read more about Countr on our website

Setup for self hosting

Copy the example.env to .env and fill in the values. Below is a table with a description for each environment variable. We've excluded some variables that are not needed for private use.

Variable Description Required
BOT_TOKEN The token of the bot Yes
API_PORT The port of the API (just put it to something like 9123) Yes
BOT_ID The ID of the bot Recommended
OWNER The ID of the owner Recommended
GUILD The ID of your main guild Recommended
ADMINS The IDs of the admins separated with a comma No
IS_PREMIUM Whether the bot is premium or not (true/false) No

Once you're done filling the values, you can do npm run docker:up. You can stop it using npm run docker:down and view logs using npm run docker:logs or by going to the logs directory.

Contributing and development

Local development

You can set it up however you'd like, however we like to use nodemon to automatically restart our bot when changes are made. Doing local development in our way is a little complicated as you need three terminals open, as well as a mongo instance, but it should be fine.

You can set up a temporary mongo instance using Docker: docker run --name countr-dev-db -d mongo:4 --ports 27000:27000 - keep in mind this won't store your data when you stop the container. You can start and stop this instance with docker start/stop countr-dev-db. YourDATABASE_URI will be mongodb://localhost:27000/countr.

You still need your envoironment variables set up and stuff though, however there are different environment variables for local development. There's more advanced environment variables than the ones listed below, you can see them all in the src/config.ts file.

Variable Description Required
BOT_TOKEN The token of the bot Yes
DATABASE_URI The URI of the mongo instance Yes
BOT_ID The ID of the bot Recommended
OWNER The ID of the owner Recommended
GUILD The ID of your main guild Recommended
ADMINS The IDs of the admins separated with a comma No
API_PORT The port of the API No
IS_PREMIUM Whether the bot is premium or not (true/false) No
  • Terminal 1: npm run watch
  • This will compile our TypeScript to JavaScript and will put it in the build folder.
  • Terminal 2: npm run start:manager
  • This will start the manager. We don't use nodemon for this as we rarely edit the manager's code anyways. It will also bug out if we use nodemon on both instances.
  • Terminal 3: nodemon -d 0.1 --watch build
  • This will start the bot, and will watch for any changes in the build folder.

Once your code is finished, make sure it's all linted. You can run npm run lint:fix to see any non-autofixable linting errors.

GitHub Codespaces (Devcontainer)

For those of you that have GitHub Pro, or in other ways have access to GitHub Codespaces, you can use a Codespace to work on Countr. We use this ourselves, and it's quite easy to set up. Just click here to create a new Codespace of this repository.

It will take a few minutes to set up, but once it's done, you can start working on Countr, but all your necessary tools will be installed automatically, including a Mongo database. A pre-configured .env file will be created for you, all you need to do is fill in the missing values.

You will still need to set up the three terminals mentioned in the local development section.

Suggestions, bugs, feature requests

Want to contribute? Great, we love that! Please take your time on opening a new issue.

Contributors

You can see all contributors and their GitHub-profiles here.

License

We use the GNU GPLv3-license.

You may copy, distribute and modify the software as long as you track changes/dates in source files. Any modifications to or software including (via compiler) GPL-licensed code must also be made available under the GPL along with build & install instructions.

Fetched from TLDRLegal, please also read the license if you plan on using the source code. This is only a short summary. Please also take note of that we are not forced to help you, and we won't help you host it yourself as we do not recommend you doing so.

Extension points exported contracts — how you extend this code

Communication (Interface)
(no doc)
src/utils/cluster/communication.ts
BaseComponent (Interface)
(no doc)
src/handlers/interactions/components.ts
Module (Interface)
(no doc)
src/constants/modules.ts
ClusterInitializeData (Interface)
(no doc)
src/utils/cluster/communication.ts
ButtonComponent (Interface)
(no doc)
src/handlers/interactions/components.ts
Property (Interface)
(no doc)
src/constants/properties/index.ts
ManagerNoticeData (Interface)
(no doc)
src/utils/cluster/communication.ts
ChannelSelectMenuComponent (Interface)
(no doc)
src/handlers/interactions/components.ts

Core symbols most depended-on inside this repo

safeSave
called by 36
src/database/models/Guild.ts
msToHumanShortTime
called by 25
src/utils/time.ts
msToHumanTime
called by 23
src/utils/time.ts
fitText
called by 13
src/utils/text.ts
bytesToHumanReadable
called by 12
src/utils/human.ts
designMessage
called by 10
src/constants/editors/flows/index.ts
format
called by 9
src/constants/properties/index.ts
reply
called by 9
src/constants/editors/properties.ts

Shape

Function 174
Interface 25
Class 22
Method 21
Enum 3

Languages

TypeScript100%

Modules by API surface

src/database/models/Guild.ts20 symbols
src/handlers/interactions/components.ts16 symbols
src/utils/cluster/communication.ts6 symbols
src/handlers/counting/flows.ts6 symbols
src/utils/time.ts5 symbols
src/utils/cluster/manager/lists.ts5 symbols
src/handlers/interactions/modals.ts5 symbols
src/constants/editors/flows/index.ts5 symbols
src/commands/mention/eval.ts5 symbols
src/commands/chatInput/modules.ts5 symbols
src/utils/text.ts4 symbols
src/handlers/counting/index.ts4 symbols

Datastores touched

(mongodb)Database · 1 repos
countrDatabase · 1 repos

For agents

$ claude mcp add countr \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact