From 4ca6c83a09c0c5518049aecd7cb10075e739af05 Mon Sep 17 00:00:00 2001
From: Whipstickgostop <8366326+Whipstickgostop@users.noreply.github.com>
Date: Fri, 11 Oct 2024 17:27:56 -0400
Subject: [PATCH] feat: support authentication, updates for Streamer.bot v0.2.5
---
.../streamerbot/StreamerbotPlayground.vue | 73 +-
apps/docs/content/3.api/0.config.md | 7 +
apps/docs/content/3.api/1.requests.md | 50 +
apps/docs/package.json | 16 +-
apps/toolkit/package.json | 8 +-
apps/toolkit/src/stores/streamerbot.store.ts | 8 +-
examples/nodejs/index.js | 2 +-
examples/nodejs/package-lock.json | 284 +++
examples/nodejs/package.json | 1 -
package.json | 2 +-
packages/client/package.json | 4 +-
packages/client/src/ws/StreamerbotClient.ts | 552 +++--
.../src/ws/types/streamerbot-auth.types.ts | 12 +
.../src/ws/types/streamerbot-request.types.ts | 2 +
.../ws/types/streamerbot-response.types.ts | 2 +
packages/client/src/ws/util/websocket.util.ts | 62 +-
packages/vue/package.json | 2 +-
.../vue/src/composables/useStreamerbot.ts | 79 +-
pnpm-lock.yaml | 1982 +++++++----------
19 files changed, 1638 insertions(+), 1510 deletions(-)
create mode 100644 examples/nodejs/package-lock.json
create mode 100644 packages/client/src/ws/types/streamerbot-auth.types.ts
diff --git a/apps/docs/app/components/streamerbot/StreamerbotPlayground.vue b/apps/docs/app/components/streamerbot/StreamerbotPlayground.vue
index ef41bca..e6ffb12 100644
--- a/apps/docs/app/components/streamerbot/StreamerbotPlayground.vue
+++ b/apps/docs/app/components/streamerbot/StreamerbotPlayground.vue
@@ -1,9 +1,14 @@
@@ -46,21 +56,29 @@ const lastRequestResponse = ref
{{ lastRequestResponse }}
diff --git a/apps/docs/content/3.api/0.config.md b/apps/docs/content/3.api/0.config.md
index 3f04df0..0bff55d 100644
--- a/apps/docs/content/3.api/0.config.md
+++ b/apps/docs/content/3.api/0.config.md
@@ -34,6 +34,13 @@ If you've modified your `WebSocket Server` settings in Streamer.bot, make sure t
```
::
+ ::field{name=password type=String}
+ Change the password to match your Streamer.bot `WebSocket Server` authentication settings, if enabled.
+ ```ts
+ const client = new StreamerbotClient({ password: 'LyfeSaverSeventyFourIsMyDaddy' });
+ ```
+ ::
+
::field{name=scheme type="`ws` | `wss`"}
Only change this if you are using a secure tunnel or otherwise know what you are doing.
- Default: `ws`
diff --git a/apps/docs/content/3.api/1.requests.md b/apps/docs/content/3.api/1.requests.md
index 54ad239..2ae6824 100644
--- a/apps/docs/content/3.api/1.requests.md
+++ b/apps/docs/content/3.api/1.requests.md
@@ -914,4 +914,54 @@ const response = await client.getUserGlobal('twitch', '12345678');
// Fetch a specific user global variable by user ID and variable name
const response = await client.getUserGlobal('twitch', '12345678', 'test');
```
+::
+
+## `sendMessage`
+_Requires Streamer.bot v0.2.5_
+
+Send a chat message to the selected platform
+
+#### Signature
+`sendMessage(platform: 'twitch' | 'youtube' | 'trovo', message: string, bot = false, internal = true): Promise