-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnorecording.js
52 lines (47 loc) · 1.69 KB
/
norecording.js
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
45
46
47
48
49
50
51
52
registerPlugin({
name: 'No Recording!',
version: '3.0.1',
backends: ['ts3'],
description: 'This script will kick anyone who attempts to record.',
author: 'SinusBot Team / Modded by Michael <[email protected]>', // Michael Friese, Max Schmitt, Jonas Bögle
vars: [{
name: 'kickMessage',
title: 'The optional kick message.',
type: 'string',
placeholder: 'No recording on our server!'
},
{
name: 'groupidallowed',
title: 'Servergruppen-ID, welche Sprachaufnahmen machen darf:',
type: 'string'
}]
}, (_, config,meta) => {
const event = require('event');
const engine = require('engine');
const backend = require('backend');
const message = meta.name + ' V' + meta.version +' > ';
const kickMessage = config.kickMessage || 'No recording on our server!'
event.on('load',() => {
if (backend.isConnected()) engine.log(message + 'loaded successfully.');
});
event.on('clientRecord', client => {
let text = message + client.name() + ' starts recording...';
if (typeof config.groupidallowed != 'undefned' && config.groupidallowed != '') {
if (isinGroup(client, parseInt(config.groupidallowed))) {
engine.log(text);
return;
} else {
client.kick(kickMessage);
engine.log(text + 'not allowed - kicked!');
}
} else {
client.kick(kickMessage);
engine.log(text + 'not allowed - kicked!');
}
});
function isinGroup(client, id) {
return client.getServerGroups().some(group => {
return group.id() == id;
});
}
})