discourse-npm
v0.0.4
Published
A simple way to create Discourse bots.
Downloads
13
Readme
discourse-npm
Basics
const disco = require('discourse-npm');
const client = new disco.Client('username', 'ApiKeyAttachedToUsername', 'https://forum.skyswift.eu');
// change 'https://forum.skyswift.eu' to any instance URL
User API
Get user by username
console.log(await client.members.getUserByUsername(username))
Group API
Create new group
console.log(await client.groups.create(name))
Admin API
Get active users
console.log(await client.members.activeAdminList())
Returns list of active users on discourse instance.
Get user by id
console.log(await client.members.getUserById(id))
Returns user object.
Delete user by id
console.log(await client.members.deleteUserById(id, deletePosts, blockMail, blockUrls, blockIp))
Deletes user from instance.
Anonymize user by id
console.log(await client.members.anonymizeUserById(id))
Anonymizes user on the instance.
Log user out by id
console.log(await client.members.logUserOutById(id))
Logs user out on the instance.
Refresh gravatar user out by username
console.log(await client.members.refreshGravatarByUsername(username))
Refreshes gravatar on instance.
Suspend user by id
console.log(await client.members.suspendUserById(id, suspendDate, reason, message, postAction))
Suspends user on the instance.