Skip to content

Commit af24120

Browse files
authored
Update webgroup docs (#48)
* Remove duplicate webgroup title * Update blockbot docs * Fix indentation
1 parent 80cae34 commit af24120

File tree

3 files changed

+47
-37
lines changed

3 files changed

+47
-37
lines changed

docs/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ This is mostly intended for admins, future admins, webmasters, and everybody els
2424

2525
## Webgroup
2626

27-
## Webgroup
28-
2927
The [webgroup](webgroup/index.md) is a subgroup of Redbrick consisting of volunteers who work with the webmaster on a number of projects.
3028

3129
## New Admins

docs/webgroup/blockbot.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,42 +46,44 @@ As a prerequisite, you need to have an application registered on the Discord dev
4646
2. Go to *"Bot"* on the left sidebar, click `Reset Token`.
4747
3. Copy the newly generated token.
4848

49-
### Source Code
49+
### Running from source (deprecated)
50+
51+
1. Fork, `git clone` and `cd` into the [blockbot repository](https://github.com/redbrick/blockbot).
52+
53+
> [!TIP]
54+
> Read the [contributing docs](./contributing.md) for more information on using Git and GitHub.
5055
51-
1. `git clone` and `cd` into the [blockbot repository](https://github.com/redbrick/blockbot).
5256
2. It is generally advised to work in a Python [virtual environment](https://docs.python.org/3/library/venv.html):
5357

54-
```sh
55-
python3 -m venv .venv
56-
source .venv/bin/activate
57-
```
58+
```sh
59+
python3 -m venv .venv
60+
source .venv/bin/activate
61+
```
5862

5963
3. Rename `.env.sample` to `.env` inside the repo folder and fill in the environment variables with your secrets. e.g.:
6064

61-
```
62-
TOKEN=<Discord bot token here>
63-
```
65+
```
66+
TOKEN=<Discord bot token here>
67+
```
6468

6569
4. Run `pip install -r requirements.txt` to install the required packages.
6670
5. Start the bot by running `python3 -m src`.
6771

68-
### Docker
72+
### Running with Docker Compose
73+
74+
1. Fork, `git clone` and `cd` into the [blockbot repository](https://github.com/redbrick/blockbot).
75+
76+
> [!TIP]
77+
> Read the [contributing docs](./contributing.md) for more information on using Git and GitHub.
6978

70-
1. `git clone` and `cd` into this repository.
71-
2. Create a new file called `.env` inside the repo folder and paste your bot token into the file as such:
72-
```
73-
TOKEN=<Discord bot token here>
74-
```
75-
3. Build the docker image `docker build --tag "blockbot-testing" .`
76-
4. Run this image `docker run "blockbot-testing"`
7779

78-
### Docker Compose
79-
1. `git clone` and `cd` into this repository.
80-
2. Create a new file called `.env` inside the repo folder and paste your bot token into the file as such:
81-
```
82-
TOKEN=<Discord bot token here>
83-
```
84-
3. Run the docker-compose.yml file `docker-compose up -d`
80+
2. Rename `.env.sample` to `.env` inside the repo folder and fill in the environment variables with your secrets. e.g.:
81+
82+
```
83+
TOKEN=<Discord bot token here>
84+
```
85+
86+
3. Run the `compose.yaml` file: `docker compose up --build`
8587

8688
## Library Resources
8789

@@ -109,7 +111,9 @@ TOKEN=<Discord bot token here>
109111
* [Getting Started](https://miru.hypergonial.com/getting_started/) - first steps of using `hikari-miru`
110112
* [Guides](https://miru.hypergonial.com/guides/) - various guides on aspects of `hikari-miru`
111113

112-
## What's the difference between `hikari`, `hikari-arc` and `hikari-miru`?
114+
## FAQ
115+
116+
### What's the difference between `hikari`, `hikari-arc` and `hikari-miru`?
113117

114118
* `hikari` - the Discord API wrapper. Can be used to, for example:
115119
* [add roles to server members](https://docs.hikari-py.dev/en/stable/reference/hikari/api/rest/#hikari.api.rest.RESTClient.add_role_to_member)
@@ -125,15 +129,15 @@ TOKEN=<Discord bot token here>
125129
* create message components (buttons, select menus & modals)
126130
* respond to component interactions (button clicks, select menu selections & modal submissions)
127131

128-
## Why use a `hikari.GatewayBot` instead of a `hikari.RESTBot`?
132+
### Why use a `hikari.GatewayBot` instead of a `hikari.RESTBot`?
129133

130134
**TL;DR:** `RESTBot`s do not receive events required for some blockbot features (e.g. starboard), so `GatewayBot` must be used instead.
131135

132136
`GatewayBot`s connect to Discord via a websocket, and Discord sends events (including interactions) through this websocket. `RESTBot`s run a web server which Discord sends only interactions to (not events) via HTTP requests. These events are required for specific blockbot features, like starboard (which uses reaction create/remove events).
133137

134138
**Further reading:** <https://arc.hypergonial.com/getting_started/#difference-between-gatewaybot-restbot>
135139

136-
## What's the difference between `hikari.GatewayBot`, `arc.GatewayClient` and `miru.Client`?
140+
### What's the difference between `hikari.GatewayBot`, `arc.GatewayClient` and `miru.Client`?
137141

138142
* `hikari.GatewayBot` is the actual Discord bot. It:
139143
* manages the websocket connection to Discord
@@ -152,3 +156,11 @@ TOKEN=<Discord bot token here>
152156
## Do's and Don'ts
153157

154158
* Always try to get data from the cache before fetching it from the API.
159+
160+
```py
161+
# command example
162+
async def command(ctx: arc.GatewayContext) -> None:
163+
user = ctx.client.cache.get_user(123)
164+
if not user:
165+
user = await ctx.client.rest.fetch_user(123)
166+
```

docs/webgroup/contributing.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ title: Contributing to Webgroup
2727

2828
- Make changes to the codebase.
2929

30-
> [!NOTE]
31-
> You don't have to make all the necessary changes in one commit. It's much better to split a bigger pull request over multiple commits. This will make it easier to manage and review.
30+
> [!NOTE]
31+
> You don't have to make all the necessary changes in one commit. It's much better to split a bigger pull request over multiple commits. This will make it easier to manage and review.
3232

3333
- Stage and commit the changes.
3434

3535
```bash
36-
git add <files you changed>
37-
git commit -m "<commit message>"
36+
git add <files you changed>
37+
git commit -m "<commit message>"
3838
```
3939

40-
> [!TIP]
41-
> See [Writing Meaningful Commit Messages](https://reflectoring.io/meaningful-commit-messages/)
40+
> [!TIP]
41+
> See [Writing Meaningful Commit Messages](https://reflectoring.io/meaningful-commit-messages/)
4242

4343
- On GitHub, navigate to your fork repository and switch to the branch you created.
4444

@@ -53,5 +53,5 @@ git commit -m "<commit message>"
5353
![Pull Request page on GitHub](../res/pull-request.png)
5454

5555

56-
> [!TIP]
57-
> For bigger contributions, it's advisable to open a draft pull request when you begin development so other maintainers (e.g. other members of webgroup) can review your changes and provide feedback as you work.
56+
> [!TIP]
57+
> For bigger contributions, it's advisable to open a draft pull request when you begin development so other maintainers (e.g. other members of webgroup) can review your changes and provide feedback as you work.

0 commit comments

Comments
 (0)