Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (38 loc) · 1.56 KB
/
Copy pathindex.js
File metadata and controls
44 lines (38 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Popup Message
*
* Displays a message, in a popup, to a user when they enter a space.
*
* All information regarding plugin development can be found at
* https://developer.vatom.com/plugins/plugins/
*
* @license MIT
* @author Vatom Inc.
*/
module.exports = class PopupMessage extends BasePlugin {
/** Plugin info */
static get id() { return 'vatominc-popup-message' }
static get name() { return 'Popup Message' }
static get description() { return 'Display a message, in a popup, to users when they enter the space.' }
/** Called when the plugin is loaded */
async onLoad() {
// Allow message to be configured
this.menus.register({
id: 'vatominc-popup-message-config',
section: 'plugin-settings',
panel: {
fields: [
{ type: 'section', name: 'Popup Message' },
{ type: 'checkbox', id: 'enabled', name: 'Enabled', help: 'When enabled, the popup will be shown.' },
{ type: 'text', id: 'title', name: 'Title', help: 'Title of the message.' },
{ type: 'text', id: 'text', name: 'Text', help: 'Text to display in the message.' },
{ type: 'select', id: 'icon', name: 'Icon', values: ['', 'info', 'warning', 'question', 'error'] }
]
}
})
// Show message now, if enabled
if (this.getField('enabled')) {
this.menus.alert(this.getField('text'), this.getField('title'), this.getField('icon'))
}
}
}