rich-presence-builder

0.1.1 • Public • Published

Rich Presence Builder

Easily build and create a Discord Rich Presence that can also be dynamic and update on an interval, with buttons!

Step 1

Install rich-presence-builder: npm i rich-presence-builder

And that's it! You can now start making cool presences with ease

Example

How to use

First create a file and import the package.

const RichPresence = require("rich-presence-builder")

Then, create a new rich presence and add what you need. Use .go() when complete

new RichPresence()
  .setState("I am in a state of panic")
  .setDetails("Made with rich-presence-builder")
  .addButton("discord home", "https://discord.com")
  .go()

After running the file, it should look something like this:

Example

  • You can also use then/await:
await new RichPresence().setDetails("I have awaited B)")
// or
new RichPresence()
  .setDetails("then what?")
  .then(rpc => console.log(rpc.details)) // "then what?"
  • You can also use the constructor to define values:
await new RichPresence({
  state: "I am in a state of panic",
  details: "yes",
  timeLeft: 60000,
  buttons: [{ label: "click me", url: "https://discord.com" }]
})
  • Everything can also be dynamic:
const rp = new RichPresence()
await rp.setState(() => `${Date.now().toLocaleTimeString()}: staying alive`)
  • You can use intervals:
// updates every 15s
await new RichPresence().setState(() => `${Date.now().toLocaleTimeString()}: staying alive`).interval()

even with a limit

// stops updating after 10 updates
await new RichPresence().setState(() => `${Date.now().toLocaleTimeString()}: staying alive`).interval(10)
  • You can use timestamps:
await new RichPresence().setElapsedTime(60) // 00:01:00 elapsed
// or
await new RichPresence().setTimeLeft(60) // 00:01:00 left

// or you can do it the old-fashioned way:
await new RichPresence().setStartTimestamp(Date.now()) // 00:00:00 elapsed
// or
await new RichPresence().setEndTimestamp(Date.now()) // 00:00:00 left
  • You can even reuse the same RichPresence:
const rp = new RichPresence
await rp.setState("saying hello")
// soon
await rp.setState("saying goodbye").setDetails("it's time to go").addButton("say goodbye")
  • You can also clear your presence if you need to:
await rp.clear()
// clear() doesn't have to remove your presence, it can also be used to clear data:
await rp.clear().setState("clean presence")

Images

If you wish to use images, please use your own application:

new RichPresence({ clientID: "383226320970055681" })
  .setLargeImage("js", "JavaScript")
  .setSmallImage("python", "Python")
  .go()

You can create an application on Discord's Developer Portal.

Package Sidebar

Install

npm i rich-presence-builder

Weekly Downloads

3

Version

0.1.1

License

ISC

Unpacked Size

16.8 kB

Total Files

5

Last publish

Collaborators

  • thenoob27