2021-07-31 22:18:07 +00:00
# Setup
## Discord Bot
- Go to https://discord.com/developers/applications and create your application
- Go to "Bot" in your newly created application and click "Add a bot"
- Give it a name which later will be your bots name, optionally upload an image which will be its profile image
- Disable "Public Bot", enable the "Privileged Gateway Intents"
2021-07-31 22:24:58 +00:00
- Copy and note your bots token (you will need to enter it into the `bot_token` field of the config)
2021-07-31 22:56:40 +00:00
- Add your bot to your server (replace `<client-id>` with the client ID of your bot, find that by clicking "OAuth2" in the left sidebar):
`https://discord.com/oauth2/authorize?client_id=<client-id>&scope=bot%20applications.commands&permissions=1945627743`
2021-07-31 22:18:07 +00:00
## Create a config
- Create a new text file named `config.yaml` (you can name it otherwise, just adapt the rest of the examples)
- Put the text shown below ("Config format") into it
- Adjust the `module_configs`
## Start the bot
### Using Docker
```console
# docker pull luzifer/discord-community
# docker run --rm -ti -v /path/to/your/configfile:/config -e CONFIG=/config/config.yaml luzifer/discord-community
```
### Using Binary
- Download the latest release from the [release page ](https://github.com/Luzifer/discord-community/releases )
- Unpack the archive you've downloaded
- Start the bot in the same directory as your config (or provide a path to the config):
```console
2021-07-31 22:22:40 +00:00
# ./discord-community_linux_amd64 --config=config.yaml
# discord-community_windows_amd64.exe --config=config.yaml
2021-07-31 22:18:07 +00:00
```
2021-07-25 12:33:17 +00:00
# Config format
```yaml
---
bot_token: '...'
guild_id: '...'
2021-08-07 20:15:58 +00:00
store_location: /path/to/storage.json
2021-07-25 12:33:17 +00:00
module_configs:
2021-08-07 20:15:58 +00:00
- id: unique id for the module instance
type: module-type
2021-07-25 12:33:17 +00:00
attributes:
key: value
...
```
2021-07-25 12:29:43 +00:00
# Modules
2021-07-25 12:26:45 +00:00
2021-07-30 22:54:28 +00:00
## Type: `clearchannel`
Cleans up old messages from a channel (for example announcement channel) which are older than the retention time
| Attribute | Req. | Type | Default Value | Description |
| --------- | :--: | ---- | ------------- | ----------- |
| `discord_channel_id` | ✅ | string | | ID of the Discord channel to clean up |
| `retention` | ✅ | duration | | How long to keep messages in this channel |
| `cron` | | string | `0 * * * *` | When to execute the cleaner |
2021-07-30 23:25:32 +00:00
| `only_users` | | []string | `[]` | When this list contains user IDs, only posts authored by those IDs will be deleted |
| `protect_users` | | []string | `[]` | When this list contains user IDs, posts authored by those IDs will not be deleted |
2021-07-30 22:54:28 +00:00
2021-07-30 00:08:39 +00:00
## Type: `liveposting`
Announces stream live status based on Discord streaming status
| Attribute | Req. | Type | Default Value | Description |
| --------- | :--: | ---- | ------------- | ----------- |
| `discord_channel_id` | ✅ | string | | ID of the Discord channel to post the message to |
| `post_text` | ✅ | string | | Message to post to channel use `${displayname}` and `${username}` as placeholders |
| `twitch_client_id` | ✅ | string | | Twitch client ID the token was issued for |
| `twitch_client_secret` | ✅ | string | | Secret for the Twitch app identified with twitch_client_id |
2021-08-07 14:28:22 +00:00
| `auto_publish` | | bool | `false` | Automatically publish (crosspost) the message to followers of the channel |
2021-08-01 00:13:05 +00:00
| `cron` | | string | `*/5 * * * *` | Fetch live status of `poll_usernames` (set to empty string to disable): keep this below `stream_freshness` or you might miss streams |
| `disable_presence` | | bool | `false` | Disable posting live-postings for discord presence changes |
| `poll_usernames` | | []string | `[]` | Check these usernames for active streams when executing the `cron` (at most 100 users can be checked) |
2021-07-30 00:08:39 +00:00
| `stream_freshness` | | duration | `5m` | How long after stream start to post shoutout |
2021-07-31 21:22:10 +00:00
| `whitelisted_role` | | string | | Only post for members of this role ID |
2021-07-30 00:08:39 +00:00
2021-07-29 21:26:30 +00:00
## Type: `liverole`
Adds live-role to certain group of users if they are streaming on Twitch
| Attribute | Req. | Type | Default Value | Description |
| --------- | :--: | ---- | ------------- | ----------- |
| `role_streamers_live` | ✅ | string | | Role ID to assign to live streamers |
| `twitch_client_id` | ✅ | string | | Twitch client ID the token was issued for |
| `twitch_client_secret` | ✅ | string | | Secret for the Twitch app identified with twitch_client_id |
2021-07-31 21:22:10 +00:00
| `role_streamers` | | string | | Only take members with this role ID into account |
2021-07-29 21:26:30 +00:00
2021-07-25 12:39:53 +00:00
## Type: `presence`
Updates the presence status of the bot to display the next stream
| Attribute | Req. | Type | Default Value | Description |
| --------- | :--: | ---- | ------------- | ----------- |
| `fallback_text` | ✅ | string | | What to set the text to when no stream is found (`playing < text > `) |
2021-07-29 19:39:14 +00:00
| `twitch_channel_id` | ✅ | string | | ID (not name) of the channel to fetch the schedule from |
| `twitch_client_id` | ✅ | string | | Twitch client ID the token was issued for |
| `twitch_token` | ✅ | string | | Token for the user the `twitch_channel_id` belongs to |
2021-07-25 12:39:53 +00:00
| `cron` | | string | `* * * * *` | When to execute the module |
2021-07-29 19:39:14 +00:00
| `schedule_past_time` | | duration | `15m` | How long in the past should the schedule contain an entry |
2021-07-25 12:39:53 +00:00
2021-08-07 20:14:01 +00:00
## Type: `reactionrole`
Creates a post with pre-set reactions and assigns roles on reaction
| Attribute | Req. | Type | Default Value | Description |
| --------- | :--: | ---- | ------------- | ----------- |
| `discord_channel_id` | ✅ | string | | ID of the Discord channel to post the message to |
| `embed_title` | ✅ | string | | Title of the embed |
2021-08-07 22:08:36 +00:00
| `reaction_roles` | ✅ | []string | | List of strings in format `emote=role-id[:set]` . `emote` equals an unicode emote (✅) or a custom emote in form `:<emote-name>:<emote-id>` . `role-id` is the integer ID of the guilds role to add with this emote. If `:set` is added at the end, the role will only be added but not removed when the reaction is removed. |
2021-08-08 11:57:28 +00:00
| `content` | | string | | Message content to post above the embed |
2021-08-07 21:45:34 +00:00
| `embed_color` | | int64 | `0x2ECC71` | Integer / HEX representation of the color for the embed |
2021-08-07 20:14:01 +00:00
| `embed_description` | | string | | Description for the embed block |
| `embed_thumbnail_height` | | int64 | | Height of the thumbnail |
| `embed_thumbnail_url` | | string | | Publically hosted image URL to use as thumbnail |
| `embed_thumbnail_width` | | int64 | | Width of the thumbnail |
2021-07-25 12:33:17 +00:00
## Type: `schedule`
2021-07-25 12:26:45 +00:00
Posts stream schedule derived from Twitch schedule as embed in Discord channel
2021-07-25 12:28:08 +00:00
| Attribute | Req. | Type | Default Value | Description |
| --------- | :--: | ---- | ------------- | ----------- |
2021-07-25 12:26:45 +00:00
| `discord_channel_id` | ✅ | string | | ID of the Discord channel to post the message to |
2021-08-07 17:26:12 +00:00
| `embed_title` | ✅ | string | | Title of the embed |
2021-07-25 12:26:45 +00:00
| `twitch_channel_id` | ✅ | string | | ID (not name) of the channel to fetch the schedule from |
| `twitch_client_id` | ✅ | string | | Twitch client ID the token was issued for |
2021-08-20 23:25:19 +00:00
| `twitch_client_secret` | ✅ | string | | Secret for the Twitch app identified with twitch_client_id |
2021-07-25 12:26:45 +00:00
| `cron` | | string | `*/10 * * * *` | When to execute the schedule transfer |
2021-08-07 21:45:34 +00:00
| `embed_color` | | int64 | `0x2ECC71` | Integer / HEX representation of the color for the embed |
2021-07-25 12:26:45 +00:00
| `embed_description` | | string | | Description for the embed block |
| `embed_thumbnail_height` | | int64 | | Height of the thumbnail |
2021-08-07 17:26:12 +00:00
| `embed_thumbnail_url` | | string | | Publically hosted image URL to use as thumbnail |
2021-07-25 12:26:45 +00:00
| `embed_thumbnail_width` | | int64 | | Width of the thumbnail |
| `schedule_entries` | | int64 | `5` | How many schedule entries to add to the embed as fields |
| `schedule_past_time` | | duration | `15m` | How long in the past should the schedule contain an entry |
2021-07-25 12:39:53 +00:00
2021-07-25 12:26:45 +00:00
<!-- vim: set ft=markdown : -->