Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 7th, 2020 308 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. registerPlugin({
  2.     name: 'List',
  3.     version: '0.1',
  4.     description: 'List the tracks on the bot with the list command.',
  5.     author: 'Monopolo11',
  6.     backends: ['ts3', 'discord'],
  7.     vars: [{
  8.         name: 'admins',
  9.         title: 'UIDs of users which have access to the command',
  10.         type: 'strings',
  11.         default: []
  12.     }]
  13. }, (_, config, meta) => {
  14.     const event = require('event')
  15.     const engine = require('engine')
  16.     const backend = require('backend')
  17.     const format = require('format')
  18.     const media = require('media')
  19.  
  20.     engine.log(`Loaded ${meta.name} v${meta.version} by ${meta.author}.`)
  21.  
  22.     event.on('load', () => {
  23.         const command = require('command')
  24.         if (!command) {
  25.             engine.log('command.js library not found! Please download command.js to y$
  26.            engine.log('command.js can be found here: https://github.com/Multivit4min$
  27.             return;
  28.         }
  29.         command.createCommand('list')
  30.         .alias('tracklist')
  31.         .help('Lists the tracks on the server')
  32.         .manual('Lists the tracks on the server')
  33.         .checkPermission(allowAdminCommands)
  34.         .addArgument(command.createArgument('string').setName('name').optional())
  35.         .exec((/** @type {Client} */client, /** @type {object} */args, /** @type {(ms$
  36.             let resp = format.bold('Tracks')
  37.                     media.getTracks().forEach(track => {
  38.                         engine.log(track.title)
  39.                         resp += track.title + '\n'
  40.                     })
  41.                         engine.log('salio del for')
  42.  
  43.             reply(resp)
  44.         })
  45.     })
  46.  
  47.     /**
  48.      * Checks if a client is allowed to use admin commands.
  49.      * @param {Client} client
  50.      * @returns {boolean}
  51.      */
  52.     function allowAdminCommands(client) {
  53.         switch (engine.getBackend()) {
  54.             case "discord":
  55.                 return config.admins.includes(client.uid().split("/")[1])
  56.             case "ts3":
  57.                 return config.admins.includes(client.uid())
  58.             default:
  59.                 throw new Error(`Unknown backend ${engine.getBackend()}`)
  60.         }
  61.     }
  62. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top