Add lint github action (#2473)

This commit is contained in:
pajlada 2021-02-21 14:45:42 +01:00 committed by GitHub
parent 714048a29e
commit e015013773
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 207 additions and 128 deletions

21
.github/workflows/lint.yml vendored Normal file
View file

@ -0,0 +1,21 @@
---
name: Lint
on:
push:
branches:
- master
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Lint Markdown files
uses: actionsx/prettier@v2
with:
# prettier CLI arguments.
args: --check '**/*.md'

5
.prettierignore Normal file
View file

@ -0,0 +1,5 @@
# Ignore submodule files
lib/*/
conan-pkgs/*/
.github/

6
.prettierrc.toml Normal file
View file

@ -0,0 +1,6 @@
trailingComma = "es5"
[[overrides]]
files = ["*.md"]
[overrides.options]
proseWrap = "preserve"

View file

@ -9,9 +9,7 @@ high that this also works on older FreeBSD releases, architectures and
FreeBSD 13.0-CURRENT.
1. Install build dependencies from package sources (or build from the
ports tree): `# pkg install qt5-core qt5-multimedia qt5-svg
qt5-qmake qt5-buildtools gstreamer-plugins-good boost-libs
rapidjson`
ports tree): `# pkg install qt5-core qt5-multimedia qt5-svg qt5-qmake qt5-buildtools gstreamer-plugins-good boost-libs rapidjson`
1. go into project directory
1. create build folder `$ mkdir build && cd build`
1. `$ qmake .. && make`

View file

@ -3,29 +3,40 @@
Note on Qt version compatibility: If you are installing Qt from a package manager, please ensure the version you are installing is at least **Qt 5.12 or newer**.
## Ubuntu 18.04
*most likely works the same for other Debian-like distros*
_most likely works the same for other Debian-like distros_
1. Install dependencies (and the C++ IDE Qt Creator) `sudo apt install qtcreator qtmultimedia5-dev libqt5svg5-dev libboost-dev libssl-dev libboost-system-dev libboost-filesystem-dev`
1. Open `chatterino.pro` with QT Creator and build
## Arch Linux
install [chatterino2-git](https://aur.archlinux.org/packages/chatterino2-git/) from the aur or build manually as follows:
1. `sudo pacman -S qt5-base qt5-multimedia qt5-svg gst-plugins-ugly gst-plugins-good boost rapidjson pkgconf openssl`
1. go into project directory
1. create build folder `mkdir build && cd build`
1. `qmake .. && make`
## Fedora 28 and above
*most likely works the same for other Red Hat-like distros. Substitue `dnf` with `yum`.*
_most likely works the same for other Red Hat-like distros. Substitue `dnf` with `yum`._
### Development dependencies
1. `sudo dnf install qt5-qtbase-devel qt5-qtmultimedia-devel qt5-qtsvg-devel libsecret-devel openssl-devel boost-devel`
1. go into project directory
1. create build folder `mkdir build && cd build`
1. `qmake-qt5 .. && make -j$(nproc)`
### Optional dependencies
*`gstreamer-plugins-good` package is retired in Fedora 31, see: [rhbz#1735324](https://bugzilla.redhat.com/show_bug.cgi?id=1735324)*
1. `sudo dnf install gstreamer-plugins-good` *(optional: for audio output)*
_`gstreamer-plugins-good` package is retired in Fedora 31, see: [rhbz#1735324](https://bugzilla.redhat.com/show_bug.cgi?id=1735324)_
1. `sudo dnf install gstreamer-plugins-good` _(optional: for audio output)_
## NixOS 18.09+
1. enter the development environment with all of the dependencies: `nix-shell -p openssl boost qt5.full pkg-config`
1. go into project directory
1. create build folder `mkdir build && cd build`

View file

@ -1,15 +1,18 @@
# Building on macOS
#### Note - If you want to develop Chatterino 2 you will also need to install Qt Creator (make sure to install **Qt 5.12 or newer**)
#### Note - Chatterino 2 is only tested on macOS 10.14 and above - anything below that is considered unsupported. It may or may not work on earlier versions
1. Install Xcode and Xcode Command Line Utilites
2. Start Xcode, settings -> Locations, activate your Command Line Tools
3. Install brew https://brew.sh/
4. `brew install boost openssl rapidjson`
5. `brew install qt`
6. Step 5 should output some directions to add qt to your path, you will need to do this for qmake
5. Go into project directory
6. Create build folder `mkdir build && cd build`
7. `qmake .. && make`
7. Go into project directory
8. Create build folder `mkdir build && cd build`
9. `qmake .. && make`
If the Project does not build at this point, you might need to add additional Paths/Libs, because brew does not install openssl and boost in the common path. You can get their path using
@ -17,6 +20,7 @@ If the Project does not build at this point, you might need to add additional Pa
`brew info boost`
If brew doesn't link openssl properly then you should be able to link it yourself using those two commands:
- `ln -s /usr/local/opt/openssl/lib/* /usr/local/lib`
- `ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl`

View file

@ -10,30 +10,35 @@ Download and install [Visual Studio 2019 Community](https://visualstudio.microso
Notes:
- This installation will take about 17 GB of disk space
- You do not need to sign in with a Microsoft account after setup completes. You may simply exit the login dialog.
- This installation will take about 17 GB of disk space
- You do not need to sign in with a Microsoft account after setup completes. You may simply exit the login dialog.
## Boost
1. First, download a boost installer appropriate for your version of Visual Studio.
- Visit the downloads list [on Bintray](https://dl.bintray.com/boostorg/release/).
- Select the latest version from the list and navigate into the `binaries/` directory.
- Download the `.exe` file appropriate to your Visual Studio installation version and system bitness (choose `x64` for 64-bit systems).
Visual Studio versions map as follows: `14.2` in the filename corresponds to MSVC 2019, `14.1` to 2017, `14.0` to 2015. _Anything prior to Visual Studio 2015 is unsupported. Please upgrade should you have an older installation._
**Convenience link for Visual Studio 2019: [Boost 1.75.0-MSVC-14.2](https://dl.bintray.com/boostorg/release/1.75.0/binaries/boost_1_75_0-msvc-14.2-64.exe)**
- Visit the downloads list [on Bintray](https://dl.bintray.com/boostorg/release/).
- Select the latest version from the list and navigate into the `binaries/` directory.
- Download the `.exe` file appropriate to your Visual Studio installation version and system bitness (choose `x64` for 64-bit systems).
Visual Studio versions map as follows: `14.2` in the filename corresponds to MSVC 2019, `14.1` to 2017, `14.0` to 2015. _Anything prior to Visual Studio 2015 is unsupported. Please upgrade should you have an older installation._
**Convenience link for Visual Studio 2019: [Boost 1.75.0-MSVC-14.2](https://dl.bintray.com/boostorg/release/1.75.0/binaries/boost_1_75_0-msvc-14.2-64.exe)**
2. When prompted where to install Boost, set the location to `C:\local\boost`.
3. After the installation finishes, rename the `C:\local\boost\lib64-msvc-14.2` (or similar) directory to simply `lib` (`C:\local\boost\lib`).
Note: This installation will take about 1.5 GB of disk space.
## OpenSSL
### For our websocket library, we need OpenSSL 1.1
1. Download OpenSSL for windows, version `1.1.1i`: **[Download](https://slproweb.com/download/Win64OpenSSL-1_1_1i.exe)**
2. When prompted, install OpenSSL to `C:\local\openssl`
3. When prompted, copy the OpenSSL DLLs to "The OpenSSL binaries (/bin) directory".
### For Qt SSL, we need OpenSSL 1.0
1. Download OpenSSL for windows, version `1.0.2u`: **[Download](https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe)**
2. When prompted, install it to any arbitrary empty directory.
3. When prompted, copy the OpenSSL DLLs to "The OpenSSL binaries (/bin) directory".
@ -46,26 +51,29 @@ Note: This installation will take about 1.5 GB of disk space.
Note: This installation will take about 200 MB of disk space.
## Qt
1. Visit the [Qt Open Source Page](https://www.qt.io/download-open-source).
2. Scroll down to the bottom
3. Then select "Download the Qt Online Installer"
Notes:
- Installing the latest **stable** Qt version is advised for new installations, but if you want to use your existing installation please ensure you are running **Qt 5.12 or later**.
- Installing the latest **stable** Qt version is advised for new installations, but if you want to use your existing installation please ensure you are running **Qt 5.12 or later**.
### When prompted which components to install:
1. Unfold the tree element that says "Qt"
2. Unfold the top most tree element (latest stable Qt version, e.g. `Qt 5.15.2`)
3. Under this version, select the following entries:
- `MSVC 2019 64-bit` (or alternative version if you are using that)
- `Qt WebEngine` (optional)
- `MSVC 2019 64-bit` (or alternative version if you are using that)
- `Qt WebEngine` (optional)
4. Under the "Tools" tree element (at the bottom), ensure that `Qt Creator X.X.X` and `Qt Creator X.X.X CDB Debugger Support` are selected. (they should be checked by default)
5. Continue through the installer and let the installer finish installing Qt.
Note: This installation will take about 2 GB of disk space.
## Compile with Breakpad support (Optional)
Compiling with Breakpad support enables crash reports that can be of use for developing/beta versions of Chatterino. If you have no interest in reporting crashes anyways, this optional dependency will probably be of no use to you.
1. Open up `lib/qBreakpad/handler/handler.pro`in Qt Creator
@ -73,20 +81,21 @@ Compiling with Breakpad support enables crash reports that can be of use for dev
3. Copy the newly built `qBreakpad.lib` to the following directory: `lib/qBreakpad/build/handler` (You will have to manually create this directory)
## Run the build in Qt Creator
1. Open the `chatterino.pro` file by double-clicking or by opening it via Qt Creator.
2. You will be presented with a screen that is titled "Configure Project". In this screen, you should have at least one option present ready to be configured, like this:
![Qt Create Configure Project screenshot](https://i.imgur.com/dbz45mB.png)
![Qt Create Configure Project screenshot](https://i.imgur.com/dbz45mB.png)
3. Select the profile(s) you want to build with and click "Configure Project".
### How to run and produce builds
- In the main screen, click the green "play symbol" on the bottom left to run the project directly.
- Click the hammer on the bottom left to generate a build (does not run the build though).
- In the main screen, click the green "play symbol" on the bottom left to run the project directly.
- Click the hammer on the bottom left to generate a build (does not run the build though).
Build results will be placed in a folder at the same level as the "chatterino2" project folder (e.g. if your sources are at `C:\Users\example\src\chatterino2`, then the build will be placed in an automatically generated folder under `C:\Users\example\src`, e.g. `C:\Users\example\src\build-chatterino-Desktop_Qt_5_15_2_MSVC2019_64bit-Release`.)
- Note that if you are building chatterino purely for usage, not for development, it is recommended that you click the "PC" icon above the play icon and select "Release" instead of "Debug".
- Output and error messages produced by the compiler can be seen under the "4 Compile Output" tab in Qt Creator.
- Note that if you are building chatterino purely for usage, not for development, it is recommended that you click the "PC" icon above the play icon and select "Release" instead of "Debug".
- Output and error messages produced by the compiler can be seen under the "4 Compile Output" tab in Qt Creator.
## Producing standalone builds
@ -96,21 +105,21 @@ To produce a standalone package, you need to generate all required files using t
To produce all supplement files for a standalone build, follow these steps (adjust paths as required):
1. Navigate to your build output directory with windows explorer, e.g. `C:\Users\example\src\build-chatterino-Desktop_Qt_5_15_2_MSVC2019_64bit-Release`
2. Enter the `release` directory
3. Delete all files except the `chatterino.exe` file. You should be left with a directory only containing `chatterino.exe`.
4. Open a `cmd` window and execute:
1. Navigate to your build output directory with windows explorer, e.g. `C:\Users\example\src\build-chatterino-Desktop_Qt_5_15_2_MSVC2019_64bit-Release`
2. Enter the `release` directory
3. Delete all files except the `chatterino.exe` file. You should be left with a directory only containing `chatterino.exe`.
4. Open a `cmd` window and execute:
cd C:\Users\example\src\build-chatterino-Desktop_Qt_5_15_2_MSVC2019_64bit-Release\release
C:\Qt\5.15.2\msvc2019_64\bin\windeployqt.exe chatterino.exe
5. Go to `C:\local\bin\` and copy these dll's into your `release folder`.
5. Go to `C:\local\bin\` and copy these dll's into your `release folder`.
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
ssleay32.dll
libeay32.dll
6. The `releases` directory will now be populated with all the required files to make the chatterino build standalone.
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
ssleay32.dll
libeay32.dll
6. The `releases` directory will now be populated with all the required files to make the chatterino build standalone.
You can now create a zip archive of all the contents in `releases` and distribute the program as is, without requiring any development tools to be present on the target system. (However, the vcredist package must be present, as usual - see the [README](README.md)).

View file

@ -4,8 +4,7 @@ This is a set of guidelines for contributing to Chatterino. The goal is to teach
# Tooling
Formatting
------
## Formatting
Code is automatically formatted using `clang-format`. It takes the burden off of the programmer and ensures that all contributors use the same style (even if mess something up accidentally). We recommend that you set up automatic formatting on file save in your editor.
@ -20,7 +19,7 @@ Try to structure your code so that comments are not required.
#### Good example
``` cpp
```cpp
/// Result is 0 if a == b, negative if a < b and positive if b > a.
/// ^^^ You can't know this from the function signature!
// Even better: Return a "strong ordering" type.
@ -30,12 +29,12 @@ int compare(const QString &a, const QString &b);
#### Bad example
``` cpp
```cpp
/*
* Matches a link and returns boost::none if it failed and a
* QRegularExpressionMatch on success.
* QRegularExpressionMatch on success.
* ^^^ This comment just repeats the function signature!!!
*
*
* @param text The text that will be checked if it contains a
* link
* ^^^ No need to repeat the obvious.
@ -43,15 +42,13 @@ int compare(const QString &a, const QString &b);
boost::optional<QRegularExpressionMatch> matchLink(const QString &text);
```
# Code
Arithmetic Types
-----
## Arithmetic Types
Arithmetic types (like char, short, int, long, float and double), bool, and pointers are NOT initialized by default in c++. They keep whatever value is already at their position in the memory. This makes debugging harder and is unpredictable, so we initialize them to zero by using `{}` after their name when declaring them.
``` cpp
```cpp
class ArithmeticTypes
{
int thisIs0{};
@ -59,10 +56,10 @@ class ArithmeticTypes
bool thisIsFalse_{};
// int a; // <- Initialized to "random" value.
// QWidget *randomPtr.
std::vector<int> myVec; // <- other types call constructors instead, so no need for {}
// std::vector<int> myVec{}; <- pointless {}
int thisIs5 = 5; // <- Also fine, we initialize it with another value.
};
@ -71,12 +68,13 @@ void myFunc() {
}
```
Passing parameters
------
## Passing parameters
The way a parameter is passed signals how it is going to be used inside of the function. C++ doesn't have multiple return values so there is "out parameters" (reference to a variable that is going to be assigned inside of the function) to simulate multiple return values.
**Cheap to copy types** like int/enum/etc. can be passed in per value since copying them is fast.
``` cpp
```cpp
void setValue(int value) {
// ...
}
@ -84,20 +82,20 @@ void setValue(int value) {
**References** mean that the variable doesn't need to be copied when it is passed to a function.
|type|meaning|
|-|-|
|`const Type& name`|*in* Parameter. It is NOT going to be modified and may be copied inside of the function.|
|`Type& name`|*out* or *in+out* Parmameter. It will be modified.|
| type | meaning |
| ------------------ | ---------------------------------------------------------------------------------------- |
| `const Type& name` | _in_ Parameter. It is NOT going to be modified and may be copied inside of the function. |
| `Type& name` | _out_ or _in+out_ Parmameter. It will be modified. |
**Pointers** signal that objects are managed manually. While the above are only guaranteed to live as long as the function call (= don't store and use later) these may have more complex lifetimes.
|type|meaning|
|-|-|
|`Type* name`|The lifetime of the parameter may exceed the length of the function call. It may use the `QObject` parent/children system.|
| type | meaning |
| ------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `Type* name` | The lifetime of the parameter may exceed the length of the function call. It may use the `QObject` parent/children system. |
**R-value references** `&&` work similar to regular references but signal the parameter should be "consumed".
``` cpp
```cpp
void storeLargeObject(LargeObject &&object) {
// ...
}
@ -109,7 +107,7 @@ void storeObject(std::unique_ptr<Object> &&object) {
void main() {
// initialize a large object (= will be expensive to copy)
LargeObject large = // ...
// Object accepts an r-value reference + we use std::move()
// => We move the object = no need to copy.
storeLargeObject(std::move(large));
@ -117,7 +115,7 @@ void main() {
// But even worse, you can't copy a unique_ptr so we need to move here!
std::unique_ptr<Object> unique = // ...
storeObject(std::move(unique));
// The pointer contained by unique has now been consumed by "storeObject"
// so it just holds a null pointer now.
assert(unique.get() == nullptr);
@ -126,19 +124,18 @@ void main() {
Generally the lowest level of requirement should be used e.g. passing `Channel&` instead of `std::shared_ptr<Channel>&` (aka `ChannelPtr`) if possible.
## Members
Members
-----
All functions names are in `camelCase`. _Private_ member variables are in `camelCase_` (note the underscore at the end). We don't use the `get` prefix for getters. We mark functions as `const` [if applicable](https://stackoverflow.com/questions/751681/meaning-of-const-last-in-a-function-declaration-of-a-class).
All functions names are in `camelCase`. *Private* member variables are in `camelCase_` (note the underscore at the end). We don't use the `get` prefix for getters. We mark functions as `const` [if applicable](https://stackoverflow.com/questions/751681/meaning-of-const-last-in-a-function-declaration-of-a-class).
``` cpp
```cpp
class NamedObject
{
public:
const QString &name() const; // <- no "get" prefix.
void setName(const QString &name);
bool hasLongName() const; // <- "has" or "is" prefix is okay
static void myStaticFunction(); // <- also lowercase
QString publicName;
@ -151,15 +148,14 @@ private:
void myFreeStandingFunction(); // <- also lower case
```
Casts
------
## Casts
- **Avoid** c-style casts: `(type)variable`.
- Instead use explicit type casts: `type(variable)`
- Or use one of [static_cast](https://en.cppreference.com/w/cpp/language/static_cast), [const_cast](https://en.cppreference.com/w/cpp/language/const_cast) and [dynamic_cast](https://en.cppreference.com/w/cpp/language/dynamic_cast)
- Or use one of [static_cast](https://en.cppreference.com/w/cpp/language/static_cast), [const_cast](https://en.cppreference.com/w/cpp/language/const_cast) and [dynamic_cast](https://en.cppreference.com/w/cpp/language/dynamic_cast)
- Try to avoid [reinterpret_cast](https://en.cppreference.com/w/cpp/language/reinterpret_cast) unless necessary.
``` cpp
```cpp
void example() {
float f = 123.456;
int i = (int)f; // <- don't
@ -168,12 +164,12 @@ void example() {
Base* base = // ...
Derived* derived = (Derived*)base; // <- don't
Derived* derived = dynamic_cast<Derived*>(base); // <- do
// Only use "const_cast" solved if using proper const correctness doesn't work.
const int c = 123;
((int &)c) = 123; // <- don't
const_cast<int &>(c) = 123; // <- do (but only sometimes)
// "reinterpret_cast" is also only required in very rarely.
int p = 123;
float *pp = (float*)&p;
@ -181,12 +177,11 @@ void example() {
}
```
## This
This
------
Always use `this` to refer to instance members to make it clear where we use either locals or members.
``` cpp
```cpp
class Test
{
void testFunc(int a);
@ -198,7 +193,7 @@ Test::testFunc(int a)
// do
this->testInt_ += 2;
this->testFunc();
// don't
testInt_ -= 123;
testFunc(2);
@ -206,15 +201,17 @@ Test::testFunc(int a)
}
```
Managing resources
------
## Managing resources
#### Regular classes
Keep the element on the stack if possible. If you need a pointer or have complex ownership you should use one of these classes:
- Use `std::unique_ptr` if the resource has a single owner.
- Use `std::shared_ptr` if the resource has multiple owners.
#### QObject classes
- Use the [object tree](https://doc.qt.io/qt-5/objecttrees.html#) to manage lifetime where possible. Objects are destroyed when their parent object is destroyed.
- If you have to explicitly delete an object use `variable->deleteLater()` instead of `delete variable`. This ensures that it will be deleted on the correct thread.
- If an object doesn't have a parent consider using `std::unique_ptr<Type, DeleteLater>` with `DeleteLater` from "src/common/Common.hpp". This will call `deleteLater()` on the pointer once it goes out of scope or the object is destroyed.

View file

@ -7,22 +7,27 @@ The Chatterino 2 wiki can be found [here](https://wiki.chatterino.com).
Contribution guidelines can be found [here](https://wiki.chatterino.com/contributing).
## Download
Current releases are available at [https://chatterino.com](https://chatterino.com).
Windows users can also install Chatterino [from Chocolatey](https://chocolatey.org/packages/chatterino).
## Nightly build
You can download the latest Chatterino 2 build over [here](https://github.com/Chatterino/chatterino2/releases/tag/nightly-build)
You might also need to install the [VC++ 2017 Redistributable](https://aka.ms/vs/15/release/vc_redist.x64.exe) from Microsoft if you do not have it installed already.
If you still receive an error about `MSVCR120.dll missing`, then you should install the [VC++ 2013 Restributable](https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe
).
If you still receive an error about `MSVCR120.dll missing`, then you should install the [VC++ 2013 Restributable](https://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe).
## Building
To get source code with required submodules run:
```
git clone --recurse-submodules https://github.com/Chatterino/chatterino2.git
```
or
```
git clone https://github.com/Chatterino/chatterino2.git
cd chatterino2
@ -38,9 +43,11 @@ git submodule update --init --recursive
[Building on FreeBSD](../master/BUILDING_ON_FREEBSD.md)
## Code style
The code is formatted using clang format in Qt Creator. [.clang-format](src/.clang-format) contains the style file for clang format.
### Get it automated with QT Creator + Beautifier + Clang Format
1. Download LLVM: https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/LLVM-11.0.0-win64.exe
2. During the installation, make sure to add it to your path
3. In QT Creator, select `Help` > `About Plugins` > `C++` > `Beautifier` to enable the plugin
@ -52,4 +59,5 @@ The code is formatted using clang format in Qt Creator. [.clang-format](src/.cla
Qt creator should now format the documents when saving it.
## Doxygen
Doxygen is used to generate project information daily and is available [here](https://doxygen.chatterino.com).

View file

@ -1,134 +1,154 @@
# Twitch API
this folder describes what sort of API requests we do, what permissions are required for the requests etc
## Kraken (V5)
We use a bunch of Kraken (V5) in Chatterino2.
### Get Cheermotes
URL: https://dev.twitch.tv/docs/v5/reference/bits#get-cheermotes
Migration path: **Not checked**
* We implement this API in `providers/twitch/TwitchChannel.cpp` to resolve a chats available cheer emotes. This helps us parse incoming messages like `pajaCheer1000`
- We implement this API in `providers/twitch/TwitchChannel.cpp` to resolve a chats available cheer emotes. This helps us parse incoming messages like `pajaCheer1000`
### Get User Emotes
URL: https://dev.twitch.tv/docs/v5/reference/users#get-user-emotes
Requires `user_subscriptions` scope
Migration path: **Unknown**
* We use this in `providers/twitch/TwitchAccount.cpp loadEmotes` to figure out which emotes a user is allowed to use!
- We use this in `providers/twitch/TwitchAccount.cpp loadEmotes` to figure out which emotes a user is allowed to use!
### AUTOMOD APPROVE
**Unofficial** documentation: https://discuss.dev.twitch.tv/t/allowing-others-aka-bots-to-use-twitchbot-reject/8508/2
* We use this in `providers/twitch/TwitchAccount.cpp autoModAllow` to approve an automod deny/allow question
- We use this in `providers/twitch/TwitchAccount.cpp autoModAllow` to approve an automod deny/allow question
### AUTOMOD DENY
**Unofficial** documentation: https://discuss.dev.twitch.tv/t/allowing-others-aka-bots-to-use-twitchbot-reject/8508/2
* We use this in `providers/twitch/TwitchAccount.cpp autoModDeny` to deny an automod deny/allow question
- We use this in `providers/twitch/TwitchAccount.cpp autoModDeny` to deny an automod deny/allow question
## Helix
Full Helix API reference: https://dev.twitch.tv/docs/api/reference
### Get Users
URL: https://dev.twitch.tv/docs/api/reference#get-users
* We implement this in `providers/twitch/api/Helix.cpp fetchUsers`.
Used in:
* `UserInfoPopup` to get ID, viewCount, displayName, createdAt of username we clicked
* `CommandController` to power any commands that need to get a user ID
* `Toasts` to get the profile picture of a streamer who just went live
* `TwitchAccount` block and unblock features to translate user name to user ID
- We implement this in `providers/twitch/api/Helix.cpp fetchUsers`.
Used in:
- `UserInfoPopup` to get ID, viewCount, displayName, createdAt of username we clicked
- `CommandController` to power any commands that need to get a user ID
- `Toasts` to get the profile picture of a streamer who just went live
- `TwitchAccount` block and unblock features to translate user name to user ID
### Get Users Follows
URL: https://dev.twitch.tv/docs/api/reference#get-users-follows
* We implement this in `providers/twitch/api/Helix.cpp fetchUsersFollows`
Used in:
* `UserInfoPopup` to get number of followers a user has
- We implement this in `providers/twitch/api/Helix.cpp fetchUsersFollows`
Used in:
- `UserInfoPopup` to get number of followers a user has
### Get Streams
URL: https://dev.twitch.tv/docs/api/reference#get-streams
* We implement this in `providers/twitch/api/Helix.cpp fetchStreams`
Used in:
* `TwitchChannel` to get live status, game, title, and viewer count of a channel
* `NotificationController` to provide notifications for channels you might not have open in Chatterino, but are still interested in getting notifications for
- We implement this in `providers/twitch/api/Helix.cpp fetchStreams`
Used in:
- `TwitchChannel` to get live status, game, title, and viewer count of a channel
- `NotificationController` to provide notifications for channels you might not have open in Chatterino, but are still interested in getting notifications for
### Follow User
URL: https://dev.twitch.tv/docs/api/reference#create-user-follows
Requires `user:edit:follows` scope
* We implement this in `providers/twitch/api/Helix.cpp followUser`
Used in:
* `widgets/dialogs/UserInfoPopup.cpp` to follow a user by ticking follow checkbox in usercard
* `controllers/commands/CommandController.cpp` in /follow command
- We implement this in `providers/twitch/api/Helix.cpp followUser`
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to follow a user by ticking follow checkbox in usercard
- `controllers/commands/CommandController.cpp` in /follow command
### Unfollow User
URL: https://dev.twitch.tv/docs/api/reference#delete-user-follows
Requires `user:edit:follows` scope
* We implement this in `providers/twitch/api/Helix.cpp unfollowUser`
Used in:
* `widgets/dialogs/UserInfoPopup.cpp` to unfollow a user by unticking follow checkbox in usercard
* `controllers/commands/CommandController.cpp` in /unfollow command
- We implement this in `providers/twitch/api/Helix.cpp unfollowUser`
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to unfollow a user by unticking follow checkbox in usercard
- `controllers/commands/CommandController.cpp` in /unfollow command
### Create Clip
URL: https://dev.twitch.tv/docs/api/reference#create-clip
Requires `clips:edit` scope
* We implement this in `providers/twitch/api/Helix.cpp createClip`
Used in:
* `TwitchChannel` to create a clip of a live broadcast
- We implement this in `providers/twitch/api/Helix.cpp createClip`
Used in:
- `TwitchChannel` to create a clip of a live broadcast
### Get Channel
URL: https://dev.twitch.tv/docs/api/reference#get-channel-information
* We implement this in `providers/twitch/api/Helix.cpp getChannel`
Used in:
* `TwitchChannel` to refresh stream title
- We implement this in `providers/twitch/api/Helix.cpp getChannel`
Used in:
- `TwitchChannel` to refresh stream title
### Create Stream Marker
URL: https://dev.twitch.tv/docs/api/reference/#create-stream-marker
Requires `user:edit:broadcast` scope
* We implement this in `providers/twitch/api/Helix.cpp createStreamMarker`
Used in:
* `controllers/commands/CommandController.cpp` in /marker command
- We implement this in `providers/twitch/api/Helix.cpp createStreamMarker`
Used in:
- `controllers/commands/CommandController.cpp` in /marker command
### Get User Block List
URL: https://dev.twitch.tv/docs/api/reference#get-user-block-list
Requires `user:read:blocked_users` scope
* We implement this in `providers/twitch/api/Helix.cpp loadBlocks`
Used in:
* `providers/twitch/TwitchAccount.cpp loadBlocks` to load list of blocked (blocked) users by current user
- We implement this in `providers/twitch/api/Helix.cpp loadBlocks`
Used in:
- `providers/twitch/TwitchAccount.cpp loadBlocks` to load list of blocked (blocked) users by current user
### Block User
URL: https://dev.twitch.tv/docs/api/reference#block-user
Requires `user:manage:blocked_users` scope
* We implement this in `providers/twitch/api/Helix.cpp blockUser`
Used in:
* `widgets/dialogs/UserInfoPopup.cpp` to block a user via checkbox in the usercard
* `controllers/commands/CommandController.cpp` to block a user via "/block" command
- We implement this in `providers/twitch/api/Helix.cpp blockUser`
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to block a user via checkbox in the usercard
- `controllers/commands/CommandController.cpp` to block a user via "/block" command
### Unblock User
URL: https://dev.twitch.tv/docs/api/reference#unblock-user
Requires `user:manage:blocked_users` scope
* We implement this in `providers/twitch/api/Helix.cpp unblockUser`
Used in:
* `widgets/dialogs/UserInfoPopup.cpp` to unblock a user via checkbox in the usercard
* `controllers/commands/CommandController.cpp` to unblock a user via "/unblock" command
- We implement this in `providers/twitch/api/Helix.cpp unblockUser`
Used in:
- `widgets/dialogs/UserInfoPopup.cpp` to unblock a user via checkbox in the usercard
- `controllers/commands/CommandController.cpp` to unblock a user via "/unblock" command
## TMI
The TMI api is undocumented.
### Get Chatters
**Undocumented**
* We use this in `widgets/splits/Split.cpp showViewerList`
* We use this in `providers/twitch/TwitchChannel.cpp refreshChatters`
- We use this in `widgets/splits/Split.cpp showViewerList`
- We use this in `providers/twitch/TwitchChannel.cpp refreshChatters`