• Stars
    star
    9
  • Rank 1,939,727 (Top 39 %)
  • Language
    Elixir
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Effortlessly expose and monitor your Revolt activities

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.

Revard's WebSocket functionality is designed to be simpler than that of Lanyard.

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 timely updates for the specified users within the ids array. If you wish to monitor the entire server, simply set it to an empty array. Conversely, if you do not want to monitor any users, set it to null.

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

Card

With new update, Revard is now able to render SVG card for your Revolt profile. This allows you to embed your Revolt profile to, for example, GitHub README.

Endpoint for card is available at /card/:id. For example:

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

Card Options

You can pass some options to customize card (as query parameter):

(anything with = means it requires a value, anything inside [] is value's format)

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

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.