Advertisement
AEAEAEAEarray

BRO 67 BOT

Oct 2nd, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const send = MPP.chat.send;
  2. const PREFIX = "@";
  3. const PREFIX_LENGTH = PREFIX.length;
  4. MPP.client.on('a', function (msg) {
  5.     // if user switches to VPN, these need to update
  6.     var yourParticipant = MPP.client.getOwnParticipant();
  7.     var yourId = yourParticipant._id;
  8.     var yourUsername = yourParticipant.name;
  9.     var username = msg.p.name;
  10.     var userId = msg.p.id;
  11.     var usercolor = msg.p.color;
  12.     // get the message as string
  13.     var input = msg.a.trim();
  14.     // evaluate input into command and possible arguments
  15.     var message = input.substring(PREFIX_LENGTH).trim();
  16.     var hasArgs = message.indexOf(' ');
  17.     var command = (hasArgs != -1) ? message.substring(0, hasArgs) : message;
  18.     var argumentsString = (hasArgs != -1) ? message.substring(hasArgs + 1).trim() : null;
  19.     var args = msg.a.match(/\w+/g);
  20.     // look through commands
  21.     var isBotOwner = userId === yourId;
  22.     switch (command.toLowerCase()) {
  23.         case "help": help(argumentsString); break;
  24.         case "say": say(argumentsString); break;
  25.         case "rev": case "reverse": reverse(argumentsString); break;
  26.         case "about": about(); break;
  27.         case "ban": ban(userId, yourId, args); break;
  28.     }
  29. })
  30.  
  31. const cmd = [
  32.     ["help", "Shows command of this bot, type help [command name] for more info"],
  33.     ["say", "This command say your message. just for fun"],
  34.     ["reverse", "this command reverse your text"],
  35.     ["about", "about this bot"],
  36.     ["ban", "if you are crown. you can ban anyone using this command"]
  37. ]
  38.  
  39. function getcmdinfo(cm, index) {
  40.     return `Command name: ${cm}, About this command: ${cmd[index][1]}`;
  41. }
  42.  
  43. function help(info) {
  44.     if (!info) {
  45.         send(`Useful: ${PREFIX}${cmd[0][0]} [command], ${PREFIX}${cmd[1][0]}, ${PREFIX}${cmd[2][0]}, ${PREFIX}${cmd[3][0]}, ${PREFIX}${cmd[4][0]}`);
  46.     } else {
  47.         switch (info.toLowerCase()) {
  48.             case "help":
  49.                 send(getcmdinfo("help", 0));
  50.                 break;
  51.             case "say":
  52.                 send(getcmdinfo("say", 1));
  53.                 break;
  54.             case "reverse": case "rev":
  55.                 send(getcmdinfo("reverse", 2));
  56.                 break;
  57.             case "about":
  58.                 send(getcmdinfo("about", 3));
  59.                 break;
  60.             case "ban":
  61.                 send(getcmdinfo(info, 4));
  62.                 break;
  63.             default:
  64.                 send("Invalid command! '" + info + "' command dosn't exsits");
  65.                 break;
  66.         }
  67.     }
  68. }
  69.  
  70. function say(input) {
  71.     if (!input) return send("Please enter a message to say! usage: " + PREFIX + "say [text]");
  72.     send("Say: " + input);
  73. }
  74.  
  75. function reverse(input) {
  76.     if (!input) return send("Please enter a text to reverse! usage: " + PREFIX + "reverse [text]");
  77.     let revtext = input.split('').reverse().join('');
  78.     if (revtext === input) return send("❎Can't reverse same word!");
  79.     send("Reversed: " + revtext);
  80. }
  81.  
  82. function about() {
  83.     send("Made by BRO 67");
  84.     send("Customized by Anonydiamond");
  85. }
  86.  
  87. function ban(user, u, args) {
  88.     if (user !== u) return send("You don't have any permission to use this command");
  89.     if (u !== MPP.client.channel.crown.userId) return send("You are not the crown");
  90.     if (!args[1] || !args[2]) return send("Please enter a user full id ban. ban requires user full id! Usage: " + PREFIX + "ban [minute] [userid]");
  91.     let min = args[1] * 60000;
  92.     let idtoban = args[2];
  93.     let users = MPP.client.ppl[idtoban].id;
  94.     try {
  95.         MPP.client.sendArray([{ m: "kickban", _id: users, ms: min }]);
  96.     } catch (err) {
  97.         send("Unknown user");
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement