node-red-contrib-chatbot
Version:
REDBot a Chat bot for a full featured chat bot for Telegram, Facebook Messenger and Slack. Almost no coding skills required
13 lines (12 loc) • 518 B
JavaScript
export default function(plugin) {
const { user, debug } = this.props || {};
const permission = plugin != null && plugin.prototype != null && plugin.prototype.constructor != null ?
plugin.prototype.constructor.permission : null;
if (user != null && user.permissions != null && user.permissions.includes(permission)) {
return true;
}
if (debug) {
// eslint-disable-next-line no-console
console.log(`Plugin ${plugin != null ? plugin.name : 'unnamed'} not loaded, missing ${permission}!`);
}
}