aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
This commit is contained in:
parent
8a1f87b993
commit
29e8198126
2 changed files with 48 additions and 102 deletions
|
@ -9,43 +9,59 @@ exports.run = async (client, message, args) => {
|
||||||
}
|
}
|
||||||
message.channel.startTyping();
|
message.channel.startTyping();
|
||||||
|
|
||||||
var user = client.getUserFromMention(args[0])
|
let users = [];
|
||||||
var user2 = client.getUserFromMention(args[1])
|
let totalLength = 0;
|
||||||
|
|
||||||
if (!user) {
|
for(let i = 0; i < args.length; i++) {
|
||||||
let users;
|
let arg = args[i];
|
||||||
users = client.searchForMembers(message.guild, args[0]);
|
|
||||||
if (users.length > 1)
|
let user = client.getUserFromMention(arg);
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
if(!user) {
|
||||||
);
|
let usersFound;
|
||||||
else if (users.length == 0)
|
usersFound = client.searchForMembers(message.guild, arg);
|
||||||
return message.channel.send(
|
if (usersFound.length > 1)
|
||||||
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
return message.channel.send(
|
||||||
);
|
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
||||||
user = users[0].user;
|
);
|
||||||
|
else if (usersFound.length == 0)
|
||||||
|
return message.channel.send(
|
||||||
|
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
||||||
|
);
|
||||||
|
user = usersFound[0].user;
|
||||||
|
}
|
||||||
|
|
||||||
|
users.push(user);
|
||||||
|
totalLength += user.username.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
let lengthPerUser = Math.floor(totalLength / users.length);
|
||||||
|
|
||||||
|
let finalName = '';
|
||||||
|
|
||||||
|
let last = -1;
|
||||||
|
|
||||||
|
for(let i = 0; i < users.length; i++) {
|
||||||
|
let user = users[i];
|
||||||
|
let l = Math.min(lengthPerUser, user.username.length);
|
||||||
|
|
||||||
|
let p = user.username.substr(last + 1, last + l);
|
||||||
|
|
||||||
|
console.log(p);
|
||||||
|
|
||||||
|
finalName = finalName + p;
|
||||||
|
|
||||||
|
last = last + l;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!user2) {
|
console.log(totalLength);
|
||||||
let users;
|
console.log(users.length);
|
||||||
users = client.searchForMembers(message.guild, args[1]);
|
console.log(lengthPerUser);
|
||||||
if (users.length > 1)
|
console.log(finalName);
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
|
||||||
);
|
|
||||||
else if (users.length == 0)
|
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
|
||||||
);
|
|
||||||
user2 = users[0].user;
|
|
||||||
};
|
|
||||||
|
|
||||||
var first = user.username.slice(0, user.username.length / 2)
|
|
||||||
var second = user2.username.slice(Math.floor(user2.username.length / 2), user2.username.length)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var attachment = new Discord.MessageAttachment(`https://api.alexflipnote.dev/ship?user=${user.avatarURL({format: "png"})}&user2=${user2.avatarURL({format: "png"})}`)
|
//var attachment = new Discord.MessageAttachment(`https://api.alexflipnote.dev/ship?user=${user.avatarURL({format: "png"})}&user2=${user2.avatarURL({format: "png"})}`)
|
||||||
message.channel.send(`Your ship name is **${first+second}!**`, attachment)
|
message.channel.send(`Your ship name is **${finalName}!**`)
|
||||||
message.channel.stopTyping();
|
message.channel.stopTyping();
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
|
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
const request = require('request')
|
|
||||||
exports.run = async (client, message, args) => {
|
|
||||||
|
|
||||||
|
|
||||||
//NOT FINISHED
|
|
||||||
|
|
||||||
if(!args[0] || !args[1]) {
|
|
||||||
return message.channel.send(`<:error:466995152976871434> Please include two users`)
|
|
||||||
}
|
|
||||||
message.channel.startTyping();
|
|
||||||
|
|
||||||
var user = client.getUserFromMention(args[0])
|
|
||||||
var user2 = client.getUserFromMention(args[1])
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
let users;
|
|
||||||
users = client.searchForMembers(message.guild, args[0]);
|
|
||||||
if (users.length > 1)
|
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
|
||||||
);
|
|
||||||
else if (users.length == 0)
|
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
|
||||||
);
|
|
||||||
user = users[0].user;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!user2) {
|
|
||||||
let users;
|
|
||||||
users = client.searchForMembers(message.guild, args[1]);
|
|
||||||
if (users.length > 1)
|
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> Found multiple users! Please be more specific or mention the user instead."
|
|
||||||
);
|
|
||||||
else if (users.length == 0)
|
|
||||||
return message.channel.send(
|
|
||||||
"<:error:466995152976871434> That user doesn't seem to exist. Try again!"
|
|
||||||
);
|
|
||||||
user2 = users[0].user;
|
|
||||||
};
|
|
||||||
|
|
||||||
var first = user.username.slice(0, secondLength - 1)
|
|
||||||
var second = user2.username.slice(secondLength)
|
|
||||||
|
|
||||||
try {
|
|
||||||
var attachment = new Discord.MessageAttachment(`https://api.alexflipnote.dev/ship?user=${user.avatarURL({format: "png"})}&user2=${user2.avatarURL({format: "png"})}`)
|
|
||||||
message.channel.send(`Your ship name is **${first+second}!**`, attachment)
|
|
||||||
message.channel.stopTyping();
|
|
||||||
} catch(err) {
|
|
||||||
message.channel.send(`<:error:466995152976871434> API error: ${err}`);
|
|
||||||
message.channel.stopTyping();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.conf = {
|
|
||||||
enabled: true,
|
|
||||||
guildOnly: true,
|
|
||||||
aliases: [],
|
|
||||||
permLevel: "User",
|
|
||||||
requiredPerms: []
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.help = {
|
|
||||||
name: "ship1",
|
|
||||||
category: "Fun",
|
|
||||||
description: "Ship two people together <3",
|
|
||||||
usage: "ship1 name name2"
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in a new issue