This package has been deprecated

Author message:

Use the toolbox-devvit package instead: https://npmjs.com/package/toolbox-devvit

@eritbh/toolbox-devvit
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

toolbox-devvit

Helpers for working with /r/toolbox data from Devvit community apps.

Installation

npm install --production @eritbh/toolbox-devvit

Usage Example

Install the library

import {Devvit, RedditAPIClient, Context} from '@devvit/public-api';
import {ToolboxClient} from '@eritbh/toolbox-devvit';

const reddit = new RedditAPIClient();
const toolbox = new ToolboxClient(reddit);

// A simple action that creates a usernote on a post's author
Devvit.addAction({
	context: Context.POST,
	name: 'Create Test Usernote',
	description: 'Creates a Toolbox usernote for testing',
	handler: async (event, metadata) => {
		const subreddit = await reddit.getCurrentSubreddit(metadata);
		const user = event.post.author!;
		const note = 'Hihi i am a note';
		await toolbox.createUsernote({subreddit, user, note}, metadata);
		return {success: true, message: 'Note added!'};
	}
});

export default Devvit;

License

MIT © eritbh

Readme

Keywords

none

Package Sidebar

Install

npm i @eritbh/toolbox-devvit

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

40.5 kB

Total Files

17

Last publish

Collaborators

  • eritbh