teamspeak-query icon indicating copy to clipboard operation
teamspeak-query copied to clipboard

Viewer

Open frct1 opened this issue 7 years ago • 7 comments

Hi, @schroffl. Do you consider an idea to create server viewer (clientlist and channellist), for example in JSON and html format. I found one , but it's seems shitty. For example: query.viewer(format:"json") which returning html or json builded server tree with clients, channels etc

frct1 avatar Aug 22 '18 09:08 frct1

If I understand you correctly you want to be able to get an html-formatted overview that you can e.g. embed in your website?

schroffl avatar Aug 22 '18 12:08 schroffl

Yes that is. Building public api for ts users and it will usefull feature

frct1 avatar Aug 22 '18 12:08 frct1

I don't think this is a good addition to this library, because it would clutter the API with functions that probably only very few people use. It would make more sense to create a separate package for this.

schroffl avatar Aug 28 '18 09:08 schroffl

@schroffl That should be very cool with using like teamspeak-filesystem package

frct1 avatar Aug 28 '18 09:08 frct1

What exactly do you mean? I don't really get how the HTML-formatted client-/channellist would be useful for the filesystem? Sorry if I misunderstood something ^^

schroffl avatar Aug 28 '18 09:08 schroffl

Oh, my english still so bad... Something like that

let teamspeakViewer=require('teamspeak-viewer');
let query=new TeamspeakQuery.Raw(*connection data*);
let viewer=teamspeakViewer(query);
console.log(viewer.json());
console.log(viewer.html());

frct1 avatar Aug 28 '18 09:08 frct1

If you want you can try to build such a package yourself, because I currently don't have the time. And besides, it's a useful learning experience :)

Also: I would just keep it a simple function that takes the client-/channelist output and builds the desired output, e.g. like this:

const viewer = require('teamspeak-viewer');

query.send('clientlist')
  .then(viewer.html)
  .then(html => { /* Do whatever you want with your html */ });

schroffl avatar Aug 28 '18 10:08 schroffl