Jump to content

BOTSTAT API & stuff


Recommended Posts

  • Advanced Members
12 hours ago, Daniel said:

Now that the API key seems to be implemented, will changes be made to botstat?

 

@Admin

I've continuously pc'd it to him because he asked me to and he just recently said "what about it" (shrug) so ... I don't have high hopes

It's already dead content anyway (like usual) because it's never up to standards upon release and features are slow to be implemented.

Link to post
Share on other sites
  • Advanced Members
2 hours ago, Junior said:

Yes, I have. I mean, apart from making it useable without dealing with client bots or bot providers.

The main usage for this (as you've said) is for using botstat (as an api) without having to use cilent bots or bot providers as a medium.

As you know, it would allow for various desktop applications to be created to push live (hopefully) updates to the chat.

 

I'm not really sure what else (besides this) which could be changed about botstat.

Right now, I was and am more concerned about usability of the already defined features, which seemed to do what we would typically expect.

After that, I hope people will have suggestions on various features to add/change for it.

 

Maybe things like:

  • Enabling/disabling powers (not super useful, but in specific scenarios, maybe)
  • Sending messages (sounds kinda yikes)
  • idk?

There really isn't more to do with it than name/status/avatar/home changes as of now that seems super useful to me.

Link to post
Share on other sites
  • Game Makers

Here we go.

 

The API is now available for public beta.

This API is only for developers who wish to edit their own data. 

 

Url: https://xat.com/api/botstat.php

 

Usage: https://xat.com/api/botstat.php?r=5&u=110110&k=MYSUPERTOKEN&a=5&h=xat.com&n=test

 

Errors list:

  • ERROR 5: The user was not found on the chatroom
  • ERROR 6: The user needs status power enabled/set
  • ERROR 7: The user needs botstat power
  • ERROR 9: Too many request. 3 packets each 20 seconds.
  • ERROR 10: Nothing to do. You didn't provide a correct parameter.

Parameters:

  • r: roomid (required)
  • u: userid (required)
  • k: token from login (required)
  • a: avatar (optional)
  • h: homepage (optional)
  • n: name (optional)
  • s: status (optional)

If you wish to send a name and status in same time, just use the 'n' parameter and set it this way: &n=NAME##STATUS.

 

Changelog:

  • API returns JSON response instead of blank page.
  • Botstat API is now working on all chats.
  • Botstat is now working for self on HTML5.

A few improvements will come later.

If you find any bugs, please report there.

 

Thank you.

Edited by SLOom
Link to post
Share on other sites
  • Game Makers
2 minutes ago, Jedi said:

 

Does it work with bots on others users ?

 

No, admins made this so only developers can edit their own data.

 

Bots have to use <bs /> packet.

 

Maybe if they get convinced, they can change it.

Link to post
Share on other sites
  • 2 weeks later...
  • Advanced Members

After playing a bit with the API, here are a few features I'd like to see added:

  • Checking the token's validity by sending a request with no room and no info (?u=12345&k=deadbeefcafebabe)
  • Specifying multiple chats in a single request (?r=123&r=5 or ?r[]=123&r[]=5)
  • Specifying no chats to affect every chats the user is currently connected at
  • Using chat names instead of id (?r=Chat or ?r=xat5)

See you in 2020 (hippo)

  • Award 1
  • Wow 1
Link to post
Share on other sites
  • Administrators

> Checking the token's validity by sending a request with no room and no info (?u=12345&k=deadbeefcafebabe)

 

Why do you want this?

 

> Specifying no chats to affect every chats the user is currently connected at

 

Hard

  • Award 2
Link to post
Share on other sites
  • Advanced Members
Just now, Admin said:

> Checking the token's validity by sending a request with no room and no info (?u=12345&k=deadbeefcafebabe)

Why do you want this?

 

People expect a program to work when they are done configuring it

I'd like to be able to check the user's token as soon as they provide it during the configuration phase (instead of having to wait for a status change)

This way, I can print an error message telling the user their uid/token couple is invalid as soon as possible

  • Award 1
Link to post
Share on other sites
  • Advanced Members

Here is a bash script that puts the UTC date before your nick

 

clock.png.d0f4d535a3cb10c0e0e5ce1dd33d45b5.png

 

I have no idea how to run this on Windows.

It might work on Mac, but I don't have one to confirm.

 

Spoiler

#!/bin/bash
readonly URL="https://xat.com/api/botstat.php"
readonly USERID=586552
readonly TOKEN="deadbeefcafebabe"
readonly CHAT=5

readonly NICK="XeR"

# Be cool, show UTC time
export TZ=UTC

while true; do
	date="$(date +'%H:%M')"
	newName="[$date]_${NICK}"

	printf '%s: ' "$date"
	curl -G "$URL" \
		--data-urlencode "u=$USERID" \
		--data-urlencode "k=$TOKEN" \
		--data-urlencode "r=$CHAT" \
		--data-urlencode "n=$newName"
	echo

	# Wait until next minute
	sleep "$[60 - $(date +'%S')]"
done

 

  • Award 4
Link to post
Share on other sites
  • Administrators

If I do

 

Checking the token's validity by sending a request with no room and no info (?u=12345&k=deadbeefcafebabe)

Specifying multiple chats in a single request (?r=123&r=5 or ?r[]=123&r[]=5)

Using chat names instead of id (?r=Chat or ?r=xat5)

 

but not this:

Specifying no chats to affect every chats the user is currently connected at

 

Is that good enough ?

  • Award 5
Link to post
Share on other sites
  • Advanced Members
20 minutes ago, Admin said:

If I do

 

Checking the token's validity by sending a request with no room and no info (?u=12345&k=deadbeefcafebabe)

Specifying multiple chats in a single request (?r=123&r=5 or ?r[]=123&r[]=5)

Using chat names instead of id (?r=Chat or ?r=xat5)

 

but not this:

Specifying no chats to affect every chats the user is currently connected at

 

Is that good enough ?

It's a good start

Link to post
Share on other sites
  • Game Makers
10 hours ago, Admin said:

If I do

 

Checking the token's validity by sending a request with no room and no info (?u=12345&k=deadbeefcafebabe)

Specifying multiple chats in a single request (?r=123&r=5 or ?r[]=123&r[]=5)

Using chat names instead of id (?r=Chat or ?r=xat5)

 

but not this:

Specifying no chats to affect every chats the user is currently connected at

 

Is that good enough ?

?r=[chat id1, chat id2]

?r=[5, 123]

 

is easier for you and us, not? because you can check it's array using PHP itself

Link to post
Share on other sites
  • Advanced Members
1 hour ago, xLaming said:

?r=[chat id1, chat id2]

?r=[5, 123]

 

is easier for you and us, not? because you can check it's array using PHP itself

honestly prefer this ↓ than json array

 

1 hour ago, xLaming said:

?r=123&r=5 or ?r[]=123&r[]=5

 

easier in some langs, harder in others; so idk

Edited by oj
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.