studo.js

Client to interact with the studo app's API

Usage no npm install needed!

<script type="module">
  import studoJs from 'https://cdn.skypack.dev/studo.js';
</script>

README

studo.js

npm License: MIT CI

Client to interact with the studo app's rest/socket.io API.

Primarily focuses on the chat for now and was made by reverse engineering the apk and network packets.

  • Works in Node.js and browsers
  • SMS: login, logout
  • Channels: subscribe, actions
  • Tabs: subscribe, scroll, search
  • Topics: subscribe, scroll, actions, create/edit, vote
  • Messages: actions, create/edit, vote

Install

npm install studo.js

Usage

Obtain token through https://studojs.netlify.app or adb.

import { Client } from 'studo.js';
// Or
const { Client } = require('studo.js');

// Setup client and connect
const client = new Client('<token>');
await client.connect();

// Automatically receives all channels at the start
client.on('channelUpdate', (channel) => {
  if (channel.name.includes('Feature')) channel.subscribe();
});

// Wait for the first (discussion) tab after subscribing to the channel
const tab = await client.once('tabUpdate');
await tab.subscribe();

// Wait for the first topic in this tab
const topic = await client.once('topicUpdate');
// Contains topic type, author name, points and time
console.log(topic.header);
// A substring of the actual message (ends with … if too long)
console.log(topic.text);
await topic.vote('UP');

client.disconnect();