Git Product home page Git Product logo

revard's Introduction

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.

revard's People

Contributors

meppu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.