This repository has been archived by the owner on Mar 31, 2024. It is now read-only.
forked from bignutty/activitysdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use console.debug * v0.2.0 - bug fixes - all (""useful"") rpc commands implemented - added close method to close the Embedded Activity * README example * 🔖 v0.2.0 * typescript & bug fixes * updated gitignore * package.json * use console.debug * README example * 🔖 v0.2.0 * 📄 copyright * ♻️ rebase merge conflict * ♻️✨ authorize & authenticate commands * package.json (v0.2.1) --------- Co-authored-by: derpystuff <[email protected]>
- Loading branch information
Showing
7 changed files
with
197 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,36 @@ | ||
# ActivitySDK | ||
![npm](https://img.shields.io/npm/v/activitysdk) | ||
|
||
Unofficial SDK to communicate between the discord client and an embedded activity. | ||
| activitysdk-ts | activitysdk | | ||
| :------------: | :---------: | | ||
| ![npm](https://img.shields.io/npm/v/activitysdk-ts) | ![npm](https://img.shields.io/npm/v/activitysdk) | | ||
|
||
Documentation and examples will be coming soon. | ||
Typescript fork of [activitysdk](http://npmjs.org/activitysdk). | ||
|
||
**Example usage:** | ||
_you **need** to use a bundler such as [vite](https://vitejs.dev/) or [webpack](https://webpack.js.org/) or any bundler you like._ | ||
```js | ||
import ActivitySDK from "activitysdk-ts"; | ||
|
||
const sdk = new ActivitySDK("app id"); | ||
|
||
sdk.on("READY", async () => { | ||
let user; | ||
try { | ||
user = (await sdk.commands.authenticate("app secret", ["identify"])).user; | ||
} catch (e) { | ||
console.error("could not authorize/authenticate"); | ||
return; | ||
} | ||
|
||
const info = document.createElement("div"); | ||
info.style.backgroundColor = "gray"; | ||
info.style.display = "inline-block"; | ||
|
||
const username = document.createElement("p"); | ||
username.innerText = user.username; | ||
username.style.color = "cyan"; | ||
|
||
info.append("Hello ", username); | ||
document.body.append(info); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.