Skip to content

Commit 22a29e0

Browse files
committed
📝 docs: update contributing guide with streamlined instructions
- Simplified and restructured the contributing guide for clarity. - Removed redundant sections and outdated content. - Added specific instructions for: - Setting up the project locally - Adding or modifying commands - Running quality checks - Updated project structure overview and command flow details. - Included security reporting guidelines and pull request checklist for contributors. These updates aim to improve contributor onboarding and streamline the contribution process.
1 parent 4989b46 commit 22a29e0

2 files changed

Lines changed: 10502 additions & 10169 deletions

File tree

CONTRIBUTING.md

Lines changed: 94 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,140 @@
1-
<!-- omit in toc -->
2-
31
# Contributing to SomeoneBack
42

5-
> [!IMPORTANT]
6-
> This document is a work in progress and may be incomplete. Thank you for your understanding.
7-
8-
First off, thanks for taking the time to contribute! ❤️
9-
10-
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉
3+
Thanks for wanting to contribute.
114

12-
> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
13-
>
14-
> - Star the project
15-
> - Tweet about it
16-
> - Refer this project in your project's readme
17-
> - Mention the project at local meetups and tell your friends/colleagues
18-
19-
<!-- omit in toc -->
5+
This project is a Discord bot running on Cloudflare Workers with `discord-hono` and TypeScript.
206

217
## Table of Contents
228

23-
- [I Have a Question](#i-have-a-question)
24-
- [I Want To Contribute](#i-want-to-contribute)
25-
- [Reporting Bugs](#reporting-bugs)
26-
- [Suggesting Enhancements](#suggesting-enhancements)
27-
- [Your First Code Contribution](#your-first-code-contribution)
28-
- [Improving The Documentation](#improving-the-documentation)
29-
- [Styleguides](#styleguides)
30-
- [Commit Messages](#commit-messages)
31-
- [Join The Project Team](#join-the-project-team)
32-
33-
## I Have a Question
34-
35-
Before you ask a question, it is best to search for existing [Issues](https://github.com/notthebestdev/someoneback/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first.
36-
37-
If you then still feel the need to ask a question and need clarification, we recommend the following:
38-
39-
- Open an [Issue](https://github.com/notthebestdev/someoneback/issues/new).
40-
- Provide as much context as you can about what you're running into.
41-
- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant.
42-
43-
We will then take care of the issue as soon as possible.
44-
45-
<!--
46-
You might want to create a separate issue tag for questions and include it in this description. People should then tag their issues accordingly.
47-
48-
Depending on how large the project is, you may want to outsource the questioning, e.g. to Stack Overflow or Gitter. You may add additional contact and information possibilities:
49-
- IRC
50-
- Slack
51-
- Gitter
52-
- Stack Overflow tag
53-
- Blog
54-
- FAQ
55-
- Roadmap
56-
- E-Mail List
57-
- Forum
58-
-->
59-
60-
## I Want To Contribute
9+
- [Quick Start](#quick-start)
10+
- [Project Structure](#project-structure)
11+
- [How Commands Work](#how-commands-work)
12+
- [Adding or Changing a Command](#adding-or-changing-a-command)
13+
- [Local Quality Checks](#local-quality-checks)
14+
- [Reporting Bugs](#reporting-bugs)
15+
- [Security](#security)
16+
- [Pull Request Checklist](#pull-request-checklist)
6117

62-
> ### Legal Notice <!-- omit in toc -->
63-
>
64-
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project licence.
18+
## Quick Start
6519

66-
### Reporting Bugs
20+
### 1) Prerequisites
6721

68-
<!-- omit in toc -->
22+
- Node.js (current LTS recommended)
23+
- npm
24+
- Wrangler (`npm install -g wrangler`)
6925

70-
#### Before Submitting a Bug Report
26+
### 2) Install dependencies
7127

72-
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
28+
```bash
29+
npm install
30+
```
7331

74-
- Make sure that you are using the latest version.
75-
- If you are looking for support, you might want to check [this section](#i-have-a-question).
76-
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/notthebestdev/someoneback/issues?q=label%3Abug).
77-
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
78-
- Collect information about the bug:
79-
- Stack trace (Traceback)
80-
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
81-
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
82-
- Possibly your input and the output
83-
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?
32+
### 3) Configure environment variables
8433

85-
<!-- omit in toc -->
34+
Create a local `.env` file for command registration:
8635

87-
#### How Do I Submit a Good Bug Report?
36+
```env
37+
DISCORD_APPLICATION_ID=your_application_id
38+
DISCORD_TOKEN=your_bot_token
39+
DISCORD_PUBLIC_KEY=your_public_key
40+
```
8841

89-
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <contact@justinn.dev>.
42+
For deployment, set secrets in Cloudflare:
9043

91-
<!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->
44+
```bash
45+
npx wrangler secret put DISCORD_APPLICATION_ID
46+
npx wrangler secret put DISCORD_PUBLIC_KEY
47+
npx wrangler secret put DISCORD_TOKEN
48+
```
9249

93-
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
50+
### 4) Register commands and deploy
9451

95-
- Open an [Issue](https://github.com/notthebestdev/someoneback/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
96-
- Explain the behavior you would expect and the actual behavior.
97-
- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
98-
- Provide the information you collected in the previous section.
52+
```bash
53+
npm run register
54+
npm run deploy
55+
```
9956

100-
Once it's filed:
57+
## Project Structure
10158

102-
- The project team will label the issue accordingly.
103-
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
104-
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
59+
- `src/index.ts`: Worker entry point and command mounting.
60+
- `src/register.ts`: Registers slash commands with Discord.
61+
- `src/commands/`: Individual command handlers.
62+
- `src/utils/members.ts`: Discord member fetching/filtering helpers.
63+
- `src/utils/permissions.ts`: Permission bit checks.
10564

106-
<!-- You might want to create an issue template for bugs and errors that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
65+
## How Commands Work
10766

108-
### Suggesting Enhancements
67+
Current slash commands:
10968

110-
This section guides you through submitting an enhancement suggestion for SomeoneBack, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
69+
- `/someone [ignore-bots]`
70+
- `/ping`
71+
- `/help`
11172

112-
<!-- omit in toc -->
73+
Flow:
11374

114-
#### Before Submitting an Enhancement
75+
1. Commands are defined for Discord in `src/register.ts`.
76+
2. Commands are mounted in the Worker app in `src/index.ts`.
77+
3. Each command handler lives in `src/commands/*.ts` and returns a Discord response with `c.res(...)`.
11578

116-
- Make sure that you are using the latest version.
117-
- Perform a [search](https://github.com/notthebestdev/someoneback/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
118-
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
79+
`/someone` specifics:
11980

120-
<!-- omit in toc -->
81+
- Requires the **Mention Everyone** permission (checked in `hasRequiredPermissions`).
82+
- Fetches up to 1000 guild members via Discord REST API.
83+
- Optionally excludes bots with the `ignore-bots` option.
84+
- Excludes the command invoker.
85+
- Chooses a target using `crypto.randomInt`.
12186

122-
#### How Do I Submit a Good Enhancement Suggestion?
87+
## Adding or Changing a Command
12388

124-
Enhancement suggestions are tracked as [GitHub issues](https://github.com/notthebestdev/someoneback/issues).
89+
When adding a new command, update all of the following:
12590

126-
- Use a **clear and descriptive title** for the issue to identify the suggestion.
127-
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
128-
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
129-
- You may want to **include screenshots or screen recordings** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [LICEcap](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and the built-in [screen recorder in GNOME](https://help.gnome.org/users/gnome-help/stable/screen-shot-record.html.en) or [SimpleScreenRecorder](https://github.com/MaartenBaert/ssr) on Linux. <!-- this should only be included if the project has a GUI -->
130-
- **Explain why this enhancement would be useful** to most SomeoneBack users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
91+
1. Add a handler file in `src/commands/`.
92+
2. Export it from `src/commands/index.ts`.
93+
3. Mount it in `src/index.ts`.
94+
4. Register it in `src/register.ts`.
95+
5. Update help text in `src/commands/help.ts`.
13196

132-
<!-- You might want to create an issue template for enhancement suggestions that can be used as a guide and that defines the structure of the information to be included. If you do so, reference it here in the description. -->
97+
If your command touches guild members or permissions, prefer reusing logic in `src/utils/members.ts` and `src/utils/permissions.ts` instead of duplicating checks.
13398

134-
### Your First Code Contribution
99+
## Local Quality Checks
135100

136-
<!-- TODO
137-
include Setup of env, IDE and typical getting started instructions?
101+
Run these before opening a PR:
138102

139-
-->
103+
```bash
104+
npm run lint
105+
npm run format
106+
```
140107

141-
### Improving The Documentation
108+
Useful additional commands:
142109

143-
<!-- TODO
144-
Updating, improving and correcting the documentation
110+
- `npm run deploy` to deploy Worker updates.
111+
- `npm run log` to inspect Worker logs in real time.
112+
- `npm run cf-typegen` to refresh Cloudflare Worker types.
145113

146-
-->
114+
## Reporting Bugs
147115

148-
## Styleguides
116+
Please open a GitHub issue and include:
149117

150-
### Commit Messages
118+
- What happened vs what you expected.
119+
- Clear reproduction steps.
120+
- Relevant environment details (OS, Node.js version, npm version).
121+
- Logs or error messages when available.
151122

152-
<!-- TODO
123+
## Security
153124

154-
-->
125+
Do not open public issues for vulnerabilities or sensitive data leaks.
155126

156-
## Join The Project Team
127+
Send security reports to: <contact@justinn.dev>
157128

158-
<!-- TODO -->
129+
## Pull Request Checklist
159130

160-
<!-- omit in toc -->
131+
Before submitting a PR:
161132

162-
## Attribution
133+
- Keep changes focused and minimal.
134+
- Follow existing TypeScript style and naming.
135+
- Run lint, tests, and format.
136+
- Update docs/help text when behavior changes.
137+
- Add or update tests for logic changes.
138+
- Include a clear PR description (what changed and why).
163139

164-
This guide is based on the [contributing.md](https://contributing.md/generator)!
140+
By contributing, you confirm you have rights to your contribution and agree to license it under this project's license.

0 commit comments

Comments
 (0)