Advertisement
Guest User

Untitled

a guest
May 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.32 KB | None | 0 0
  1. registerPlugin({
  2.     name: 'Custom Commands',
  3.     version: '2.0',
  4.     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.',
  5.     author: 'Smallo',
  6.     engines: '>= 0.9.16',
  7.    
  8.     vars: [{
  9.         name: 'BlockedExtras',
  10.         title: 'Blocked User Groups and Blocked Messages.',
  11.         type: 'array'
  12.         vars: [{
  13.             name: 'BlockedID',
  14.             title: 'Group ID which is not allowed to use the music bot.',
  15.             placeholder: '31',
  16.             type: 'string'
  17.         }, {
  18.             name: 'BlockedMsg',
  19.             title: 'Message to send to this group when they try to use a command.',
  20.             placeholder: 'Sorry you have been blocked from using the bot.',
  21.             type: 'string'
  22.         }]
  23.     }, {
  24.         name: 'CommandPrefix',
  25.         title: 'Prefix for commands.',
  26.         placeholder: '! or . or /',
  27.         type: 'string'
  28.     }, {
  29.         name: 'VolumeLow',
  30.         title: 'Volume Low Setting',
  31.         placeholder: '3',
  32.         type: 'string'
  33.     }, {
  34.         name: 'VolumeMed',
  35.         title: 'Volume Medium Setting',
  36.         placeholder: '10',
  37.         type: 'string'
  38.     }, {
  39.         name: 'VolumeHigh',
  40.         title: 'Volume High Setting',
  41.         placeholder: '18',
  42.         type: 'string'
  43.     }],
  44. }, function (sinusbot, config, info) {
  45.  
  46.     // include modules
  47.     var event = require('event');
  48.     var engine = require('engine');
  49.     var backend = require('backend');
  50.     var media = require('media');
  51.     var prefix = config.CommandPrefix;
  52.        
  53.     event.on('chat', function (ev) {
  54.         if (!ev.client.isSelf()) {
  55.             if (ev.text == prefix + 'volume low') { //volume med
  56.                 config.BlockedExtras.forEach(function(Extras) {
  57.                     ev.client.getServerGroups().forEach(function(group) {
  58.                         if (group.id() == Extras.BlockedID) {
  59.                             ev.client.chat(Extras.BlockedMsg);
  60.                             return;
  61.                         } else {
  62.                             setVolume(config.VolumeLow);
  63.                         }
  64.                     });
  65.                 });
  66.             }
  67.            
  68.             if (ev.text == prefix + 'volume med') { //volume med
  69.                 config.BlockedExtras.forEach(function(Extras) {
  70.                     ev.client.getServerGroups().forEach(function(group) {
  71.                         if (group.id() == Extras.BlockedID) {
  72.                             ev.client.chat(Extras.BlockedMsg);
  73.                             return;
  74.                         } else {
  75.                             setVolume(config.VolumeMed);
  76.                         }
  77.                     });
  78.                 });
  79.             }
  80.            
  81.             if (ev.text == prefix + 'volume high') { //volume high
  82.                 config.BlockedExtras.forEach(function(Extras) {
  83.                     ev.client.getServerGroups().forEach(function(group) {
  84.                         if (group.id() == Extras.BlockedID) {
  85.                             ev.client.chat(Extras.BlockedMsg);
  86.                             return;
  87.                         } else {
  88.                             setVolume(config.VolumeHigh);
  89.                         }
  90.                     });
  91.                 });
  92.             }    
  93.            
  94.             if (ev.text == prefix + 'next') { //next Song
  95.                 config.BlockedExtras.forEach(function(Extras) {
  96.                     ev.client.getServerGroups().forEach(function(group) {
  97.                         if (group.id() == Extras.BlockedID) {
  98.                             ev.client.chat(Extras.BlockedMsg);
  99.                             return;
  100.                         } else {
  101.                             next();
  102.                         }
  103.                     });
  104.                 });
  105.             }    
  106.            
  107.             if (ev.text == prefix + 'stop') { //stop Song
  108.                 config.BlockedExtras.forEach(function(Extras) {
  109.                     ev.client.getServerGroups().forEach(function(group) {
  110.                         if (group.id() == Extras.BlockedID) {
  111.                             ev.client.chat(Extras.BlockedMsg);
  112.                             return;
  113.                         } else {
  114.                             stop();
  115.                         }
  116.                     });
  117.                 });
  118.             }
  119.         }
  120.     });
  121. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement