CollabVM API
Here are various endpoints that can be used to pull data from CollabVM
All endpoints can be accessed at https://cvmapi.elijahr.dev
VM List
GET /api/v1/list
Get a list of VMs the bot has access to, and their node IDs.
VM Info
GET /api/v1/vminfo/vm1
Pull some data about the current state of the VM. vm1
should be replaced with the node ID of the VM in question.
Returns the following data, in JSON format:
ID
: Node ID of the VMUsers
: Current online users on the VM. Each user is an object with the following properties:Username
: Username of the userRank
: 0 (Unregistered), 2 (Admin), or 3 (Mod)
TurnQueue
: List of users in the turn queue, the first being the one with the turn. null if nobody has the turn.VoteInfo
: Information about the current Vote For Reset. Contains the following properties:Yes
: Number of users voting to reset the VMNo
: Number of users voting AGAINST resetting the VMTime
: Time left on the vote, in milliseconds
Screenshot
GET /api/v1/screenshot/vm1
Grab a screenshot of the VM. Returns it as a PNG image. vm1 should be replaced with the Node ID of the VM in question. Can optionally be suffixed with .png
Chat Logs
GET /api/v1/chatlogs
Grab chats from the logs. Data goes back to 06/30/2022.
Accepts the following optional query parameters:
vm
: Filter to one VM. Formatted asVM{1-8}
username
: Filter to one usernamefrom
: Filter to messages after the specified timestamp, formatted asYYYY-MM-DD hh:mm:ss
. Times in UTCto
: Filter to messages before the specified timestamp, formatted asYYYY-MM-DD hh:mm:ss
. Times in UTCcount
: Truncate result to n messages. Must be a positive integer.random
: If1
, select random messages instead of newest. Only takes effect ifcount
is set.regex
: Regular expression to filter messages with. Uses MySQL Regular Expression Syntax
If you do not provide any query parameters it simply returns the last 10 messages logged.
Returns a JSON array with an entry for each message. A message is represented by an object with the following properties:
username
: User who sent the messagemessage
: The chat messagetimestamp
: Time the message was sent, inYYYY-MM-DD hh:mm:ss
format. Times in UTCvm
: VM the message was sent to.