Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const send = MPP.chat.send;
- const PREFIX = "@";
- const PREFIX_LENGTH = PREFIX.length;
- MPP.client.on('a', function (msg) {
- // if user switches to VPN, these need to update
- var yourParticipant = MPP.client.getOwnParticipant();
- var yourId = yourParticipant._id;
- var yourUsername = yourParticipant.name;
- var username = msg.p.name;
- var userId = msg.p.id;
- var usercolor = msg.p.color;
- // get the message as string
- var input = msg.a.trim();
- var request = msg.a.split(' ')[0];
- // evaluate input into command and possible arguments
- var message = input.substring(PREFIX_LENGTH).trim();
- var hasArgs = message.indexOf(' ');
- var command = (hasArgs != -1) ? message.substring(0, hasArgs) : message;
- var argumentsString = (hasArgs != -1) ? message.substring(hasArgs + 1).trim() : null;
- var args = msg.a.match(/\w+/g);
- // look through commands
- var isBotOwner = userId === yourId;
- switch (request.toLowerCase()) {
- case PREFIX+"help": help(argumentsString); break;
- case PREFIX+"say": say(argumentsString); break;
- case PREFIX+"rev": case PREFIX+"reverse": reverse(argumentsString); break;
- case PREFIX+"about": about(); break;
- case PREFIX+"ban": ban(userId, yourId, args); break;
- case PREFIX+"8ball": case PREFIX+"8": ball(argumentsString); break;
- case PREFIX+"coinflip": case PREFIX+"cf": coin(username); break;
- }
- })
- const cmd = [
- ["help", "Shows command of this bot, type help [command name] for more info"],
- ["say", "This command say your message. just for fun"],
- ["reverse", "this command reverse your text"],
- ["about", "about this bot"],
- ["ban", "if you are crown. you can ban anyone using this command"],
- ["8ball", "This is magic 8ball! it can ans your question"],
- ["coinflip", "flip a coin"]
- ]
- function getcmdinfo(cm, index) {
- return `Command name: ${cm}, About this command: ${cmd[index][1]}`;
- }
- function help(info) {
- if (!info) {
- send(`Useful: ${PREFIX}${cmd[0][0]} [command], ${PREFIX}${cmd[1][0]}, ${PREFIX}${cmd[2][0]}, ${PREFIX}${cmd[3][0]}, ${PREFIX}${cmd[4][0]}, ${PREFIX}${cmd[5][0]}, ${PREFIX}${cmd[6][0]}`);
- } else {
- switch (info.toLowerCase()) {
- case "help":
- send(getcmdinfo("help", 0));
- break;
- case "say":
- send(getcmdinfo("say", 1));
- break;
- case "reverse": case "rev":
- send(getcmdinfo("reverse", 2));
- break;
- case "about":
- send(getcmdinfo("about", 3));
- break;
- case "ban":
- send(getcmdinfo(info, 4));
- break;
- case "8ball": case "8":
- send(getcmdinfo("8ball", 5));
- break;
- case "coinflip": case "cf":
- send(getcmdinfo("coinflip", 6));
- default:
- send("Invalid command! '" + info + "' command dosn't exsits");
- break;
- }
- }
- }
- function say(input) {
- if (!input) return send("Please enter a message to say! usage: " + PREFIX + "say [text]");
- send("Say: " + input);
- }
- function reverse(input) {
- if (!input) return send("Please enter a text to reverse! usage: " + PREFIX + "reverse [text]");
- let revtext = input.split('').reverse().join('');
- if (revtext === input) return send("❎Can't reverse same word!");
- send("Reversed: " + revtext);
- }
- function about() {
- send("Made by BRO 67");
- send("Customized by Anonydiamond");
- }
- function ban(user, u, args) {
- if (user !== u) return send("You don't have any permission to use this command");
- if (u !== MPP.client.channel.crown.userId) return send("You are not the crown");
- if (!args[1] || !args[2]) return send("Please enter a user full id ban. ban requires user full id! Usage: " + PREFIX + "ban [minute] [userid]");
- let min = args[1] * 60000;
- let idtoban = args[2];
- let users = MPP.client.ppl[idtoban].id;
- try {
- MPP.client.sendArray([{ m: "kickban", _id: users, ms: min }]);
- } catch (err) {
- send("Unknown user");
- }
- }
- function ball(input) {
- if (!input) return send("Please ask a question to 8 ball. Usage: 8ball [question]");
- let replays = ["yes", "Outlook seems good", "yus", "of course", "Yes - definitely", "no", "Better not tell you now.", "Outlook is not so good..", "nah", "never", "Cannot predict now.", "I dont know.", "I dont know *yet*..", "not a chance", "I think so.", "only for today!", "not for today", "sadly..yes", "sadly no..", "maybe", "ask againlater.."];
- let replay = replays[Math.floor(Math.random() * replays.length)];
- send(`🎱 ${replay}`);
- }
- function coin(name) {
- let lucks = ["heads", "tails"];
- let luck = lucks[Math.floor(Math.random() * lucks.length)];
- send(`${name} flip a coin! get ready`);
- setTimeout(()=>{
- send("It was " + luck);
- }, 3000)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement