- Notifications
You must be signed in to change notification settings - Fork6
🚀 Use Lanyard API easily in your React app!
License
NotificationsYou must be signed in to change notification settings
barbarbar338/react-use-lanyard
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Use Lanyard API easily in your React app!
Get support »
Report Bug ·Request Feature ·What Is Lanyard
- Using yarn:
yarn add react-use-lanyard
- Using npm:
npm i react-use-lanyard
Using without websocket:
import{useLanyard}from"react-use-lanyard";functionApp(){constlanyard=useLanyard({userId:"952574663916154960",});return(<pre>{!lanyard.isValidating&&JSON.stringify(lanyard,null,4)}</pre>);}exportdefaultApp;
Using with websocket:
import{useLanyard}from"react-use-lanyard";functionApp(){const{ loading, status/*, websocket */}=useLanyard({userId:"952574663916154960",socket:true,});return<pre>{!loading&&JSON.stringify(status,null,4)}</pre>;}exportdefaultApp;
You can create/delete KV pairs using this package.
import{set,del}from"react-use-lanyard";// Set KV pairawaitset({apiKey:"your_api_key",// get it using .apikey command on lanyard botuserId:"your_user_id",key:"test_key",value:"test value",// apiUrl: "lanyard.338.rocks", // if you are using self-hosted api, not required by default});// Delete KV pairawaitdel({apiKey:"your_api_key",userId:"your_user_id",key:"test_key",// apiUrl: "lanyard.338.rocks", // if you are using self-hosted api, not required by default});
You can use this package to connect to your own self-hosted Lanyard API. To do this, you need to pass theapiUrl
option to theuseLanyard
hook. SeeLanyard self-hosting guide for more information.
Using without websocket:
import{useLanyard}from"react-use-lanyard";functionApp(){constlanyard=useLanyard({userId:"952574663916154960",apiUrl:"lanyard.338.rocks",});return(<pre>{!lanyard.isValidating&&JSON.stringify(lanyard,null,4)}</pre>);}exportdefaultApp;
Using with websocket:
import{useLanyard}from"react-use-lanyard";functionApp(){const{ loading, status/*, websocket */}=useLanyard({userId:"952574663916154960",socket:true,apiUrl:"lanyard.338.rocks",});return<pre>{!loading&&JSON.stringify(status,null,4)}</pre>;}exportdefaultApp;
Copyright © 2021Barış DEMİRCİ.
Distributed under theGPL-3.0 License. SeeLICENSE
for more information.
Feel free to use GitHub's features.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/my-feature
) - Run prettier and eslint (
npm run format && npm run lint
) - Commit your Changes (
git commit -m 'my awesome feature my-feature'
) - Push to the Branch (
git push origin feature/my-feature
) - Open a Pull Request
Give a ⭐️ if this project helped you!
- Mail:demirci.baris38@gmail.com
- Discord:https://discord.gg/BjEJFwh
- Instagram:https://www.instagram.com/ben_baris.d/
- Phineas - Creator ofLanyard API
- Eggsy - Creator ofvue-lanyard
About
🚀 Use Lanyard API easily in your React app!
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published