Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- registerPlugin({
- name: 'Custom Commands',
- version: '2.0',
- description: 'Allows anyone to skips songs, stop songs and adjust volume via !next, !stop and !volume low/med/high. Also you can blacklist certain usergroups from accessing these commands.',
- author: 'Smallo',
- engines: '>= 0.9.16',
- vars: [{
- name: 'BlockedExtras',
- title: 'Blocked User Groups and Blocked Messages.',
- type: 'array'
- vars: [{
- name: 'BlockedID',
- title: 'Group ID which is not allowed to use the music bot.',
- placeholder: '31',
- type: 'string'
- }, {
- name: 'BlockedMsg',
- title: 'Message to send to this group when they try to use a command.',
- placeholder: 'Sorry you have been blocked from using the bot.',
- type: 'string'
- }]
- }, {
- name: 'CommandPrefix',
- title: 'Prefix for commands.',
- placeholder: '! or . or /',
- type: 'string'
- }, {
- name: 'VolumeLow',
- title: 'Volume Low Setting',
- placeholder: '3',
- type: 'string'
- }, {
- name: 'VolumeMed',
- title: 'Volume Medium Setting',
- placeholder: '10',
- type: 'string'
- }, {
- name: 'VolumeHigh',
- title: 'Volume High Setting',
- placeholder: '18',
- type: 'string'
- }],
- }, function (sinusbot, config, info) {
- // include modules
- var event = require('event');
- var engine = require('engine');
- var backend = require('backend');
- var media = require('media');
- var prefix = config.CommandPrefix;
- event.on('chat', function (ev) {
- if (!ev.client.isSelf()) {
- if (ev.text == prefix + 'volume low') { //volume med
- config.BlockedExtras.forEach(function(Extras) {
- ev.client.getServerGroups().forEach(function(group) {
- if (group.id() == Extras.BlockedID) {
- ev.client.chat(Extras.BlockedMsg);
- return;
- } else {
- setVolume(config.VolumeLow);
- }
- });
- });
- }
- if (ev.text == prefix + 'volume med') { //volume med
- config.BlockedExtras.forEach(function(Extras) {
- ev.client.getServerGroups().forEach(function(group) {
- if (group.id() == Extras.BlockedID) {
- ev.client.chat(Extras.BlockedMsg);
- return;
- } else {
- setVolume(config.VolumeMed);
- }
- });
- });
- }
- if (ev.text == prefix + 'volume high') { //volume high
- config.BlockedExtras.forEach(function(Extras) {
- ev.client.getServerGroups().forEach(function(group) {
- if (group.id() == Extras.BlockedID) {
- ev.client.chat(Extras.BlockedMsg);
- return;
- } else {
- setVolume(config.VolumeHigh);
- }
- });
- });
- }
- if (ev.text == prefix + 'next') { //next Song
- config.BlockedExtras.forEach(function(Extras) {
- ev.client.getServerGroups().forEach(function(group) {
- if (group.id() == Extras.BlockedID) {
- ev.client.chat(Extras.BlockedMsg);
- return;
- } else {
- next();
- }
- });
- });
- }
- if (ev.text == prefix + 'stop') { //stop Song
- config.BlockedExtras.forEach(function(Extras) {
- ev.client.getServerGroups().forEach(function(group) {
- if (group.id() == Extras.BlockedID) {
- ev.client.chat(Extras.BlockedMsg);
- return;
- } else {
- stop();
- }
- });
- });
- }
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement