@@ -10,17 +10,21 @@ The script is based off of dougdougw's twitchplays [script](https://www.dougdoug
...
@@ -10,17 +10,21 @@ The script is based off of dougdougw's twitchplays [script](https://www.dougdoug
## CLI Flags
## CLI Flags
-`--offline-mode <arg>` (optional) | Starts the script in offline mode, which lets you test the script from the command line.
-`--offline-mode` (optional) | Starts the script in offline mode, which lets you test the script from the command line.
-`--gen-key` (optional) | Generates a new Twitch OAuth key and saves it to the config.
## Code Consistency
## Code Consistency
The TwitchPlays script uses [PEP 8](https://www.python.org/dev/peps/pep-0008/), the official Python style guide.
The TwitchPlays script uses [PEP 8](https://www.python.org/dev/peps/pep-0008/), the official Python style guide.
## Quote Marks
## Quote Marks
In the case of [string quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes), **we choose to use 'single quotes'** over "double quotes". Please stick to this rule. However, PEP 8 specifies to use the opposite kind of quote if a quote mark features in the string to avoid escaping those characters with backslashes. Double quotes should always be used for """triple-quoted strings""".
In the case of [string quotes](https://www.python.org/dev/peps/pep-0008/#string-quotes), **we choose to use 'single quotes'** over "double quotes". Please stick to this rule. However, PEP 8 specifies to use the opposite kind of quote if a quote mark features in the string to avoid escaping those characters with backslashes. Double quotes should always be used for """triple-quoted strings""".
## Lists and Arrays
## Lists and Arrays
We use the following format for lists/arrays.
We use the following format for lists/arrays.
```python
```python
...
@@ -30,6 +34,7 @@ my_list = [
...
@@ -30,6 +34,7 @@ my_list = [
]
]
```
```
## Version Number
## Version Number
The script (for the most part) follows [semver](https://semver.org)(short for semantic versioning) where each part of the version number has a specific meaning. For our script, we use the following format:
The script (for the most part) follows [semver](https://semver.org)(short for semantic versioning) where each part of the version number has a specific meaning. For our script, we use the following format:
```
```
...
@@ -41,12 +46,14 @@ When one of these parts is increased, the ones following it must be set to zero.
...
@@ -41,12 +46,14 @@ When one of these parts is increased, the ones following it must be set to zero.
"Major or medium changes" are things like adding, removing, or changing important parts of a command (for example, making a new command or changing the arguments of an existing command). "Minor changes or bug fixes" are things like adding or changing features that don't directly affect commands or fixing small to medium size bugs in the script or commands (for example, the recent Unicode bug in the type command falls under this category).
"Major or medium changes" are things like adding, removing, or changing important parts of a command (for example, making a new command or changing the arguments of an existing command). "Minor changes or bug fixes" are things like adding or changing features that don't directly affect commands or fixing small to medium size bugs in the script or commands (for example, the recent Unicode bug in the type command falls under this category).
## Error Logging
## Error Logging
The script uses [Sentry](https://sentry.io) to log and keep track of errors throughout each release.
The script uses [Sentry](https://sentry.io) to log and keep track of errors throughout each release.
Sentry logging is automatically disabled for non-production environments unless `force_sentry_enabled` is `True` in `config.toml`. For production environments, the `sentry_enabled` setting in `config.toml` will enable or disable Sentry logging.
Sentry logging is automatically disabled for non-production environments unless `force_sentry_enabled` is `True` in `config.toml`. For production environments, the `sentry_enabled` setting in `config.toml` will enable or disable Sentry logging.
## Updating requirements.txt
## Updating requirements.txt
Adhering to best practices, we include version numbers in our [requirements file](https://gitlab.com/controlmypc/TwitchPlays/-/blob/master/requirements.txt) in the format package==x.x.x
Adhering to best practices, we include version numbers in our [requirements file](https://gitlab.com/controlmypc/TwitchPlays/-/blob/master/requirements.txt) in the format package==x.x.x
...
@@ -82,8 +89,10 @@ And finally create the new requirements file with your new requirement included
...
@@ -82,8 +89,10 @@ And finally create the new requirements file with your new requirement included
pip3 freeze > requirements.txt
pip3 freeze > requirements.txt
```
```
## Commands
## Commands
### Categories
### Categories
Commands can be separated into categories:
Commands can be separated into categories:
...
@@ -113,6 +122,7 @@ Commands can be separated into categories:
...
@@ -113,6 +122,7 @@ Commands can be separated into categories:
The order of the commands within the script should roughly match the order of the commands on the [command list on the website](https://cmpc.live/commands/)[(source)](https://gitlab.com/controlmypc/web/-/blob/master/commands/index.html). This makes it easier to ensure the lists match.
The order of the commands within the script should roughly match the order of the commands on the [command list on the website](https://cmpc.live/commands/)[(source)](https://gitlab.com/controlmypc/web/-/blob/master/commands/index.html). This makes it easier to ensure the lists match.
In the future, we maybe should consider generating a list of commands using the script for that purpose.
In the future, we maybe should consider generating a list of commands using the script for that purpose.
## Restricted Commands
## Restricted Commands
These commands are not listed on the website and are therefore documented here instead.
These commands are not listed on the website and are therefore documented here instead.
...
@@ -135,9 +145,12 @@ If the user is cmpcscript this will be logged and if cmpcscript's message matche
...
@@ -135,9 +145,12 @@ If the user is cmpcscript this will be logged and if cmpcscript's message matche
It has been put in place that toml will remain the standard configuration format for the script.
It has been put in place that toml will remain the standard configuration format for the script.
It has also been motioned and put into place, that the twitch vars should not change within the toml file, if something is added to the toml, it can be, but nothing should ever be removed.
It has also been motioned and put into place, that the twitch vars should not change within the toml file, if something is added to the toml, it can be, but nothing should ever be removed.
## Testing
To run the script follow the instructions in the [readme](https://gitlab.com/controlmypc/TwitchPlays/-/blob/master/README.md).
## Running
To run the script follow the instructions in projects [readme](https://gitlab.com/controlmypc/TwitchPlays/-/blob/master/README.md).
See the available start up [flags](documentation/script#cli-flags for the script.