You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: design.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ A scrappy first-draft of how this program (v2) works.
3
3
4
4
## Files
5
5
***main/fetch.go** – Twitch API routines to `auth()` and `fetch()` data
6
-
***main/main.go** – core init and worker routines + twicord init
6
+
***main/main.go** – core init and worker routines + dir init
7
7
***main/msg.go** – Discord message channel init, worker, API methods
8
8
***main/role.go** – Discord role init, execution task, API methods
9
9
***main/stream.go** – streams struct with conversion methods + filter
@@ -20,7 +20,7 @@ This struct (defined in streams.go) and its conversions are the core data flow i
20
20
21
21
**Data transitions r.e. messages:**
22
22
***user, start, thumbnail**: these 3 properties are set from incoming data in `newStreamFromTwitch()`, and never modified. The state stream copies the first snapshot during an add, then isn't touched, and gets encoded to + decoded from Discord messages.
23
-
***filter**: this is calculated from incoming data by checking twicord and running `filter()` on the title, but otherwise behaves as user/start/thumbnail. This means once the first snapshot enters internal state after an add, it will never change. However, filtered/unfiltered channels see different streams of snapshots (based on checking the filter), so messages representing the same stream may still differ between the two.
23
+
***filter**: this is calculated from incoming data by checking dir and running `filter()` on the title, but otherwise behaves as user/start/thumbnail. This means once the first snapshot enters internal state after an add, it will never change. However, filtered/unfiltered channels see different streams of snapshots (based on checking the filter), so messages representing the same stream may still differ between the two.
24
24
***title**: this is set in an incoming snapshot or persisted message from the relevant read data, then every command other than remove updates it in internal state to match the latest snapshot.
25
25
***length**: this is not set in an incoming snapshot, read if it exists from a persisted message, and otherwise *only* calculated (from the state stream's start) and set during a remove.
26
26
@@ -91,7 +91,7 @@ Any changes to or recovery of the bot are done by restarting it, at any time. It
91
91
`msgAgent.init()` looks at the last 50 messages in its Discord channel and takes ownership of any representing active streams, reading info about a stream from its message into the state.
92
92
93
93
**role**:
94
-
`roleInit()` creates a one-off inverted twicord, then goes through the entire user-list of the server to find matches. The initial state is then that, with unrecognised role-holders being flagged for removal by inserting their Discord ID instead of their twitch handle into the state (this is both unique and will never match a Twitch username).
94
+
`roleInit()` creates a one-off inverted dir, then goes through the entire user-list of the server to find matches. The initial state is then that, with unrecognised role-holders being flagged for removal by inserting their Discord ID instead of their twitch handle into the state (this is both unique and will never match a Twitch username).
95
95
96
96
## Comparing Msg and Role
97
97
msg is the more suitable design, since it gives a sequential consistency guarantee to the state, and Discord API rate limits are scoped to the channel/role, i.e. exactly the requests managed by a single instance of msg/role, so they can be paced precisely in series.
Copy file name to clipboardExpand all lines: readme.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -14,17 +14,17 @@ New streams are posted with a green embed. When a stream goes offline, its post
14
14
**Roles**
15
15
A user simply has the role while live. Display the role in the members sidebar, and each user's stream will be easily clickable provided ey is online on Discord, has Twitch correctly linked, and has streamer mode enabled.
16
16
17
-
*Since Discord doesn't reveal a user's associated Twitch account to bots, the roles functionality requires manually-posted lists of Discord user IDs and associated Twitch usernames, marked **twicord**, in a separate Discord channel. The bot will parse the 50 latest posts in a channel that have a syntax as follows:*
17
+
*Since Discord doesn't reveal a user's associated Twitch account to bots, the roles functionality requires manually-posted lists of Discord user IDs and associated Twitch usernames, marked **dir**, in a separate Discord channel. The bot will parse the 50 latest posts in a channel that have a syntax as follows:*
18
18
19
19
```
20
-
twicord <optional-comment-here-with-no-newlines>
20
+
dir <optional-comment-here-with-no-newlines>
21
21
<discord-user-ID-1> <twitch-user-handle1>
22
22
<discord-user-ID-2> <twitch-user-handle2>
23
23
...
24
24
```
25
25
26
26
**Filtering**
27
-
The twicord tables inherently filter which Discord users get assigned a role. A message channel can also be filtered. This means it accepts only streams whose users are in twicord or whose tags/titles match a list of tags/keywords. E.g.
27
+
The dir tables inherently filter which Discord users get assigned a role. A message channel can also be filtered. This means it accepts only streams whose users are in dir or whose tags/titles match a list of tags/keywords. E.g.
***GAME** – ID of the game to track (requires an API request to find out).
65
65
***MSG_CHANNELS** – list of Discord channel IDs separated by commas, no spaces. Prepend + for filtered channels and * for unfiltered. E.g. `+693315004228698142,*296066428694429697`.
66
66
***MSG_ICON** – custom icon for message embeds.
67
-
***MSG_ICON_PASS** – icon for streams that pass the filter (tag/keyword/twicord); requires and overrides `MSG_ICON`.
68
-
***MSG_ICON_KNOWN** – icon for users that are in twicord; requires and overrides `MSG_ICON_PASS`.
67
+
***MSG_ICON_PASS** – icon for streams that pass the filter (tag/keyword/dir); requires and overrides `MSG_ICON`.
68
+
***MSG_ICON_KNOWN** – icon for users that are in dir; requires and overrides `MSG_ICON_PASS`.
69
69
***ROLE** – ID of Discord streams role.
70
70
***ROLE_SERVER** – ID of Discord server containing streams role.
71
-
***TWICORD_CHANNEL** – ID of Discord channel for loading twicord directory.
71
+
***TWICORD_CHANNEL** – ID of Discord channel for loading dir directory.
72
72
***FILTER_TAGS** – list of Twitch tags to filter streams for (in UUID format), separated by commas, no spaces.
73
73
***FILTER_KEYWORDS** – list of substrings to filter stream titles for, separated by commas, no spaces.
0 commit comments