GithubHelp home page GithubHelp logo

davidegalilei / nimpresence Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 46 KB

A simple to use async Nim library which aims to use Discord's rich presence API with ease

License: MIT License

Nim 100.00%
nim discord async library rich presence rich-presence

nimpresence's Introduction

nimpresence banner
A simple to use async Nim library which aims to use Discord's rich presence API with ease

NimPresence

Features

  • It's async
  • Works on both Unix and Windows
  • Has no external dependencies
  • It's easy to use (check examples folder)

Installation

$ nimble install https://github.com/DavideGalilei/nimpresence

How to get Client ID?

Go to https://discord.com/developers/applications, authenticate, create an application, and get its client id. I will leave mine in the examples to make them reproducible.

Usage

discard await presence.update(
    state = some "Test #1",
    details = some r"`\(^~^)/`"
    `end` = some getTime().toUnix() + 1000,
    buttons = some @[
        Button(label: "aaaaa", url: "https://google.com"),
        Button(label: "aaaaa", url: "https://google.com")
    ]
)

โš ๏ธ If the library is not working

  • Mixing parameters such as match/spectate/join with buttons is not permitted, and will not update your presence (try with different options)
  • If you make too much requests in a short while, discord may ratelimit you for some minutes, try again later
  • If it gives compile errors, remember that you need to use the some function from std/options library, since optional parameters are used in Presence.update(...)

Credits

Special thanks to pypresence, which let me understand how Discord's socket works.

License

This project is under MIT license.

nimpresence's People

Contributors

davidegalilei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.