Skip to content

Commit

Permalink
refactor:improve example documentation
Browse files Browse the repository at this point in the history
- Revised the .env.example file for clarity on obtaining credentials.
- Improving type safety and clarity.
- Adjusted error handling to ensure all required credentials are validated before using protected routes.
  • Loading branch information
retconned committed Dec 7, 2024
1 parent 6fb5fde commit 07162da
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7,404 deletions.
8 changes: 2 additions & 6 deletions examples/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ TOKEN=""
COOKIES=""
BEARER=""

# just send a message to a channel with your BOT ACC and user Inspector (CTRL+SHIFT+I) find request with numbers on Network tab EXAMPLE: 1385936
# and look up to Request Headers and find Authorization
# and copy the value of Authorization and paste it in BEARER (without Bearer)
# and copy the value of Cookie and paste it in COOKIES
# and copy the value of x-csrf-token and paste it in TOKEN
# to find the value of x-csrf-token you can use the Application tab in the Inspector and look up to Cookies and find x-csrf-token
# Send a message to a channel with your Kick account and use chrome dev tools (CTRL+SHIFT+I) and find request in the Network tab.
# You'll find your token(aka x-csrf-token),bearer,cookies in the headers of your message request
10 changes: 5 additions & 5 deletions examples/basic-bot.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { createClient, type MessageData } from "@retconned/kick-js";
import "dotenv/config";

const client = createClient("xqc", { logger: true });

client.on("ready", () => {
console.log(`Bot ready & logged into ${client.user?.tag}!`);
});

const token = process.env.TOKEN;
const cookies = process.env.COOKIES;
const bearer = process.env.BEARER;
// currently not implemented just yet

client.login({ token: token, cookies: cookies, bearer: bearer });
// const token = process.env.TOKEN!;
// const cookies = process.env.COOKIES!;
// const bearerToken = process.env.BEARER!;
// client.login({ token, cookies, bearerToken });

client.on("ChatMessage", async (message: MessageData) => {
console.log(`${message.sender.username}: ${message.content}`);
Expand Down
Loading

0 comments on commit 07162da

Please sign in to comment.