-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'file-storage' of https://github.com/mewbotorg/mewbot in…
…to file-storage
- Loading branch information
Showing
110 changed files
with
7,394 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# SPDX-FileCopyrightText: 2023 Mewbot Developers <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
name: Reuse SPDX Lint | ||
run-name: "Checking for licensing issues in \"${{ github.ref }}\"" | ||
|
||
on: push | ||
|
||
jobs: | ||
SPDX-Lint: | ||
name: Check Reuse Compliance | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: REUSE Compliance Check | ||
uses: fsfe/reuse-action@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,91 @@ SPDX-FileCopyrightText: 2021 - 2023 Mewbot Developers <[email protected] | |
SPDX-License-Identifier: CC-BY-4.0 | ||
--> | ||
|
||
# Running discord bot examples | ||
|
||
## acquire a discord token | ||
|
||
To run a bot on discord you need to acquire a bot token. | ||
This is a string of numbers and letters which identifies your bot to discord when it tries to log in. | ||
|
||
Tokens can have a number of different properties, or scopes. | ||
These determine what you can do with a token. | ||
|
||
I recommend following the [official discord guide](https://discordgsm.com/guide/how-to-get-a-discord-bot-token). | ||
Which should walk you through the process. | ||
|
||
Remember - if you want to view the contents of discord messages, you will need to enable the message content permission for the bot. | ||
If you don't do this, all the message contents you see will be blank. | ||
|
||
## prepare discord bot yaml | ||
|
||
Now select the bot you want to actually run. | ||
Each of the yaml files included in `examples\discord_bots` represents | ||
|
||
```yaml | ||
kind: IOConfig | ||
implementation: mewbot.io.discord.DiscordIO | ||
uuid: aaaaaaaa-aaaa-4aaa-0000-aaaaaaaaaa00 | ||
properties: | ||
token: "[token goes here]" | ||
|
||
--- | ||
``` | ||
|
||
Once you have prepared your token, paste it into the IOConfig block of the yaml for the bot you want to run. | ||
|
||
The IOConfig block, for your token, should look something like | ||
|
||
```yaml | ||
kind: IOConfig | ||
implementation: mewbot.io.discord.DiscordIO | ||
uuid: aaaaaaaa-aaaa-4aaa-0000-aaaaaaaaaa00 | ||
properties: | ||
token: "a-series-of-letters-and-numbers-that-is-your-token" | ||
|
||
--- | ||
``` | ||
|
||
Note the ``" "`` around your token. | ||
This indicates, to the yaml, that your token should be treated as a string. | ||
If you omit them, the yaml will be invalid and will not run. | ||
|
||
### run the example - windows | ||
|
||
Turning mewbot yaml into a bot is a fairly straightforward operation. | ||
|
||
#### Through python and examples | ||
|
||
You can use the code in the `__main__.py` file of examples. | ||
Running something like | ||
|
||
```shell | ||
(mewbot_venv) C:\mewbot_dev\mewbot>python src\examples examples\discord_bots\history_discord_bot.yaml | ||
``` | ||
|
||
#### Through the examples file in tools | ||
|
||
You could also use the `sh` file found in the tools folder, running something like | ||
|
||
```shell | ||
(mewbot_venv) C:\mewbot_dev\mewbot>sh tools/examples examples\discord_bots\history_discord_bot.yaml | ||
``` | ||
|
||
NOTE - the direction of the `/` in `tools/examples`. | ||
If you get it the wrong way round, `sh` would be able to interpret the path and you'll get an error like | ||
|
||
```shell | ||
(mewbot_venv) C:\mewbot_dev\mewbot>sh tools\examples examples\discord_bots\history_discord_bot.yaml | ||
tools\examples: line 7: tools\examples/path: Not a directory | ||
tools\examples: line 9: exec: : not found | ||
``` | ||
|
||
### run the example - linux | ||
|
||
(I don't have a functioning linux box for this rn, so will fill this in later). | ||
|
||
## FAQ | ||
|
||
### Why am I getting blank events when messages are sent in channels the bot is monitoring? | ||
|
||
As of late August 2022, discord bots now need the message content permission to be explicitly enabled (was implicitly enabled up to this point). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2023 Mewbot Developers <[email protected]> | ||
SPDX-License-Identifier: BSD-2-Clause | ||
--> | ||
|
||
# MyPy | ||
|
||
MyPy is a python type analyser/linter. | ||
|
||
mypy enforces the requirement for type annotations, and also performs type-checking | ||
based on those annotations and resolvable constants. | ||
|
||
## MyPy Failure Modes | ||
|
||
The most common issue people will encounter is caused by empty directories | ||
left behind when changing branches. This will only occur locally, as CI | ||
runs use fresh filesystems. | ||
|
||
``` | ||
(mewbot_venv) C:\mewbot_dev\mewbot> sh tools/lint | ||
Black (Formatter) | ||
================= | ||
All done! ✨ 🍰 ✨ | ||
36 files left unchanged. | ||
Flake8 | ||
====== | ||
MyPy (type checker) | ||
=================== | ||
There are no .py[i] files in directory 'C:\mewbot_dev\mewbot\plugins\mewbot-client_for_reddit\tests' | ||
[...clipped...] | ||
``` | ||
|
||
The solution here is to confirm that the directory is in fact empty, and then | ||
remove it from your copy. | ||
|
||
Further information on this issue can be found in https://github.com/mewbotorg/mewbot/issues/180. |
Oops, something went wrong.