Special characters handling
* Fix README for python version * Add discord-friendly unidecode function for channel names (avoiding special characted) * Check if "items" is present before accessing in channel id request response
This commit is contained in:
parent
8d76596ebf
commit
d015927861
10 changed files with 315 additions and 13 deletions
13
README.md
13
README.md
|
|
@ -5,14 +5,14 @@ This is the bot for the breadtube application for Discord.
|
|||
|
||||
## Install
|
||||
|
||||
The breadtube bot needs Python to be installed (minimum tested version is 3.10). There is no other dependencies.
|
||||
The breadtube bot needs Python to be installed (minimum tested version is 3.11). There is no other dependencies.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
The bot needs 2 token:
|
||||
* A discord bot token in `data/` : in your discord application's `settings` under `Bot` you'll have to click on the `Reset Token` button (even if you just created a new application) to retreive this token. The token will only appear once, after resetting it.
|
||||
* A google api token in `data/` : you can create one from the google API console [https://console.cloud.google.com/apis/credentials](https://console.cloud.google.com/apis/credentials), you should have a `Create credentials` button in the top menu then select `API key`. You can restrict the key to only `Youtube Data API` as no other API will be used by the bot.
|
||||
* A discord bot token in `data/discord_bot_token.txt` : in your discord application's `settings` under `Bot` you'll have to click on the `Reset Token` button (even if you just created a new application) to retreive this token. The token will only appear once, after resetting it.
|
||||
* A google api token in `data/google_api_key.txt` : you can create one from the google API console [https://console.cloud.google.com/apis/credentials](https://console.cloud.google.com/apis/credentials), you should have a `Create credentials` button in the top menu then select `API key`. You can restrict the key to only `Youtube Data API` as no other API will be used by the bot.
|
||||
|
||||
The Google API Key is only used to search channel from their URL and find their ID.
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ All of the following needs to be done as root (administrator privilege).
|
|||
|
||||
If you want the bot to run automatically on a Linux server you can setup a systemd service by adding a file in `/etc/systemd/system`, like `/etc/systemd/system/breadtube-bot.service` (here the service name will be `breadtube-bot`) then you need to run `systemctl daemon-reload` to read/accept the new service. From here `systemctl` can be used with the commands `enable`/`disable` to make the service run at startup and `start`/`stop`/`status` to manually start, stop or check if it is running (example: `systemctl start breadtube-bot`).
|
||||
|
||||
Additionnaly you can check all the logs of a service using `journalctl -u baguettetube-bot` (`-f` to 'follow' in real-time the logs).
|
||||
Additionnaly you can check all the logs of a service using `journalctl -u breadtube-bot` (`-f` to 'follow' in real-time the logs).
|
||||
|
||||
Sample of a service file running from a created `breadtube` user (it is highly recommended to run as a isolated user):
|
||||
|
||||
|
|
@ -43,3 +43,8 @@ ExecStart=python3 start.py [discord-server-id]
|
|||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
Credit to the Text::Unidecode project ([https://metacpan.org/pod/Text::Unidecode#LICENSE](https://metacpan.org/pod/Text::Unidecode)) for the data enabling converting non ASCII characters into closest ASCII ones.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue