Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.
/ revard Public archive

Effortlessly expose and monitor your Revolt activities

License

Notifications You must be signed in to change notification settings

meppu/revard

Repository files navigation

logo

Revard

Revard is a basic implementation of Lanyard for Revolt.


Index

Introduction

Revard empowers you to effortlessly expose and monitor your Revolt activities.

An instance is currently running at revard.meppu.boo. Before using it, you must join this server.

REST API

Retrieving user information

GET /api/users/:id

Give it a try: https://revard.meppu.boo/api/users/01F6YN5JWMHJFKPDZVYB6434HX

Example response:

{
  "_id": "01H30ENXEN04AJFV7PBF8G8BH3",
  "avatar": {
    "_id": "3BwmoTaiAoIBunlZxpVyi4s6TOpmS-BG8YDB0ItXjt",
    "content_type": "image/png",
    "filename": "FwMNRM3WYBQ5w4j.png",
    "metadata": {
      "height": 400,
      "type": "Image",
      "width": 427
    },
    "size": 81008,
    "tag": "avatars"
  },
  "badges": 0,
  "bot": {
    "owner": "01F6YN5JWMHJFKPDZVYB6434HX"
  },
  "discriminator": "2007",
  "online": true,
  "username": "Glowie"
}

Avatar Endpoint

GET /api/users/:id/avatar

Returns the avatar image of the specified user. (It actually redirects 🤓)

Background Endpoint

GET /api/users/:id/background

Returns the background image of the specified user. (It actually redirects 🤓)

WebSocket

Check out this file for an example of WebSocket usage.

You can establish a WebSocket connection by using the /gateway endpoint. Revard uses JSON for sending and receiving data.

After connecting, you need to send a ping every 30 seconds. You can accomplish this by sending a ping frame or by simply sending the following data:

{ "event": "ping" }

To subscribe to one or more users, make use of the subscribe event:

{
  "event": "subscribe",
  "ids": ["01H30ENXEN04AJFV7PBF8G8BH3", "01F6YN5JWMHJFKPDZVYB6434HX"]
}

By doing so, you will receive real-time updates for the specified users within the ids array. If the ids is an empty list ([]) or null, it will unsubscribe from all the subscriptions without returning anything.

To update subscribers, resend the same data with the updated ids value.

⚠️ Starting from version 0.5.4, The capability to monitor all members on the server has been removed as a precautionary measure against potential misuse.

Retrieve Subscribed User List

⚠️ This feature has been introduced in version 0.6.0.

The list event is utilized to request the list of users who have subscribed. Once the server receives this message, it responds with a message that includes the list of currently subscribed users.

The format of the message is as follows:

{ "event": "list" }

The response message will provide the desired list of subscribed users.

Card

With the new update, Revard now has the capability to render an SVG card for your Revolt profile. This allows you to embed your Revolt profile, for example, in your GitHub README.

The endpoint for the card is available at /card/:id. For example:

  • https://revard.meppu.boo/card/01F6YN5JWMHJFKPDZVYB6434HX

    card

Card Options

You can provide certain options to customize the card using query parameters:

Anything with = requires a value, anything inside [] denotes the format of the value.

  • hide_banner: Hides your profile background.
  • hide_badges: Hides your badges.
  • hide_status: Hides your text status.
  • bg_color=[hexadecimal color without #]: Changes the background color.
  • mask_color=[hexadecimal color without #]: Changes the color of the semi-transparent mask.

Example usage:

minimal-card

Self-hosting

If you prefer not to join our server or want to make it specific to your own server, you can host Revard yourself.

Environment variables

Before running the bot, you must set the following environment variables:

  • BOT_TOKEN: Your bot's token. Please note that self-bots are not supported at the moment.
  • REVOLT_SERVER_ID: The server ID to watch. To avoid conflicts, ensure that your bot is only in one server.
  • REVOLT_SERVER_LINK: The URL for Revolt server redirection.
  • MONGO_URL: The URL for MongoDB (must support SSL).
  • PORT: The port to listen on. If not given, it falls back to 8000.

Additionally, if you are using this bot for another Revolt host, you need to set these special environment variables:

Docker

You can use Docker to host your own bot. For example:

$ docker run --env-file=.env ghcr.io/meppu/revard:latest start

Contributing

You can always report bugs and request features via GitHub Issues.

When submitting pull requests, ensure that your code is well-formatted and can adequately explain itself.

License

Revard is licensed under the MIT License.