Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RozmarinUS committed Jul 9, 2024
1 parent b3fdd48 commit 85fa3eb
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/content/contributing/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
label: 'Contributing'
position: 99
collapsible: true
collapsed: false
69 changes: 69 additions & 0 deletions docs/content/contributing/code-of-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
id: code-of-conduct

title: Code of Conduct

sidebar_position: 2
---

# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
71 changes: 71 additions & 0 deletions docs/content/contributing/commit-convention.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
id: commit-convention

title: Commit convention

sidebar_position: 3
---

## Git Commit Message Convention

:::info

This is adapted from [Angular's commit convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular).

:::

#### TL;DR:

Commit titles must match the following regex:

```js
/^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\(.+\))?: .{1,72}/;
```

### Full Message Format

A commit message consists of a **header**, **body** and **footer**. The header has a **type**, **scope** and **subject**:

```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```

The **header** is mandatory and the **scope** of the header is optional.

### Revert

If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body, it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.

### Type

If the prefix is `feat`, `fix` or `perf`, it will appear in the changelog. However, if there is any [BREAKING CHANGE](#footer), the commit will always appear in the changelog.

Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`, `style`, `refactor`, and `test` for non-changelog related tasks.

### Scope

The scope refers to which section of the application the changes took place in, such as `SlashCommand`, `ContextMenu`, or `MessageComponents`

### Subject

The subject contains a succinct description of the change:

- Use the imperative, present tense: "change", not "changed" nor "changes"
- do not capitalize the first letter
- do not end you message with a period (.)

### Body

Like in the **subject**, use the imperative, present tense
The body should include the motivation for the change and difference with the previous behavior.

### Footer

The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.

**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
31 changes: 31 additions & 0 deletions docs/content/contributing/contribution-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
id: contribution-guide

title: Contribution Guide

sidebar_position: 1
---

# Contributing

If you wish to contribute to the nestgram codebase or documentation, feel free to fork the repository and submit a
pull request. We use ESLint to enforce a consistent coding style, so having that set up in your editor of choice
reduces friction contributing to this project.

## Setup

You will need [Node.js](http://nodejs.org) **version 16+**, and [npm](https://www.npmjs.com/).

To get ready to work on the codebase, please do the following:

1. Fork & clone the repository. Make sure you're up-to-date with the **master** branch!
2. Install the dependencies using `npm ci`
3. Code your heart out!
4. Run `npm lint` to run ESLint and ensure changes respect our styleguide
5. [Submit a pull request](https://github.com/GlobalArtInc/nestgram/compare)

A high level overview of tools used:

- [TypeScript](https://www.typescriptlang.org/) as the development language
- [Eslint](https://eslint.org/) for code-style
- [Prettier](https://prettier.io/) for code formatting
17 changes: 17 additions & 0 deletions docs/content/contributing/funding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
id: funding

title: Funding

sidebar_position: 4
---

# Funding

NestGram is an open source project with its ongoing development made possible thanks to the support by the community.
This library is a result of the long road, full of sleepless nights, working after hours, and busy weekends.

If you wish to support NestGram financially, thank you!
You can use the following methods to send your donation:

- become a backer or sponsor on [OpenCollective](https://opencollective.com/GlobalArtInc)
33 changes: 33 additions & 0 deletions docs/content/text-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
id: text-commands

slug: text-commands

title: Text Commands

description: Text commands are the most common type of command. They are used to send a message to the channel.

sidebar_position: 5
---

Create a simple command handler for messages using `@TextCommand`.

```typescript title="src/app.service.ts"
import { Injectable } from '@nestjs/common';
import { Context, TextCommand, CommandContext } from '@nestgramjs/core';

@Injectable()
export class AppService {
@TextCommand({
name: 'start',
description: 'Start command!',
})
public onStart(@Context() [ctx]: TextCommandContext) {
return ctx.reply('Start command triggered!');
}
}
```

If all goes well, you should see something like this:

![Text Command](/img/content/text_command.png 'Text Command')
Binary file added docs/static/img/content/text_command.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/app/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export class AppService {
description: 'Displays this help message.',
})
onStart(@Context() [ctx]: CommandContext) {
ctx.reply('Start message');
ctx.reply('Start message triggered');
}
}

0 comments on commit 85fa3eb

Please sign in to comment.