Admin Plugin

This plugin let's you administrate your bots.

Config

admins

This configuration is an array of objects with any number of the following properties

  • nickname
  • username
  • hostname
  • identifiedas

The first three will be converted to a case-insensitive regular expression.

If a user matches the regex for the first three properties (of those that exist) and is identified or authenticated under the nickname of the identifiedas property, the user is considered an admin.

For example, {"nickname": "^havvy$", "identifiedas": "havvy"} will only consider a user with the nickname of exactly havvy and identified to services as havvy is considered an admin.

Multiple admin objects allow multiple admins. A user only has to match under one object to be considered an admin.

admin-commands

A list of commands that you want to force to be only available for admins. E.g., to make !learn and !forget from the factoids plugin only available to admins, you can have the value for this configuration property to be ["learn", "forget"].

admin-failed-attempt-response

The Response to show when a user without permission attempts to use an admin-only command.

Defaults to "Permission Denied".

Exports

isAdmin(hostmask: Hostmask, opts: optional Object) -> boolean

In v3.2 the signature was isAdmin(hostmask: Hostmask, customAdmins: [Admin]). In v4.0 and higher, that is now isAdmin(hostmask: Hostmask, {customAdmins: [Admin]})

Determines whether the user is an admin.

Options

customAdmins
A list of Admin objects to use as admins for this call (and only this call).
memoizeOver
An object used to memoize over whois requests. Should be something that is shortly lived, like a corresponding Message that caused you to want to check if somebody is an admin.

requiresAdmin(fn: Function) -> Function

Wraps a function making it require admin priviledges to use.

In the case that the use is not an admin, the bot will respond with the admin-failed-attempt-response.