mirror of
https://github.com/danbulant/Shasha
synced 2026-05-24 12:22:00 +00:00
docker support
This commit is contained in:
parent
5f5b8a480f
commit
fad493f8a6
3 changed files with 13 additions and 134 deletions
|
|
@ -1,132 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const { default: fetchNeko } = require("nekos-best.js");
|
||||
const { parseComa, getMember, defaultImageEmbed } = require("../../resources/functions");
|
||||
|
||||
module.exports = async (msg, arg, name, endsaT = "") => {
|
||||
msg.channel.startTyping();
|
||||
let shoot = msg.member,
|
||||
target = [],
|
||||
iC = 0;
|
||||
if (!arg) {
|
||||
shoot = msg.guild.member(msg.client.user);
|
||||
iC++;
|
||||
target.push(msg.member.displayName);
|
||||
}
|
||||
if (!shoot.user.dbLoaded) await shoot.user.dbLoad();
|
||||
const args = parseComa(arg);
|
||||
if (args?.length > 0) {
|
||||
const mul = {
|
||||
H: {
|
||||
l: 0,
|
||||
i: -1
|
||||
},
|
||||
C: {}
|
||||
}
|
||||
for (const key of args) {
|
||||
if (!key || key.length === 0) continue;
|
||||
const t = getMember(msg.guild, key)?.[0]?.displayName;
|
||||
if (!t) continue;
|
||||
if (t === shoot.displayName) {
|
||||
const ifH = target.includes("themself (is this even physically possible)");
|
||||
if (ifH) {
|
||||
target.filter((v, i) => {
|
||||
if (v === "themself (is this even physically possible)") {
|
||||
mul.H.i = i;
|
||||
mul.H.l++;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
target.push("themself (is this even physically possible)");
|
||||
}
|
||||
} else {
|
||||
const ifC = target.includes(t);
|
||||
if (ifC) {
|
||||
target.filter((v, i) => {
|
||||
if (v === t) {
|
||||
if (!mul.C[v]) {
|
||||
mul.C[v] = {
|
||||
l: 1,
|
||||
i: i
|
||||
};
|
||||
} else {
|
||||
mul.C[v].l++;
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
target.push(t);
|
||||
}
|
||||
iC++;
|
||||
}
|
||||
}
|
||||
if (mul.H.i > -1) {
|
||||
switch (mul.H.l) {
|
||||
case 1:
|
||||
target[mul.H.i] += " twice!";
|
||||
break;
|
||||
case 2:
|
||||
target[mul.H.i] += " thrice!!";
|
||||
break;
|
||||
default:
|
||||
target[mul.H.i] += ` ${mul.H.l++} times LMFAO`;
|
||||
}
|
||||
}
|
||||
for (const li in mul.C) {
|
||||
const d = mul.C[li];
|
||||
d.l++;
|
||||
switch (d.l) {
|
||||
case 2:
|
||||
target[d.i] += " twice";
|
||||
break;
|
||||
case 3:
|
||||
target[d.i] += " thrice XD";
|
||||
break;
|
||||
default:
|
||||
target[d.i] += ` ${d.l} times ❤️`;
|
||||
}
|
||||
}
|
||||
}
|
||||
let lT, tN, sT;
|
||||
if (target.length > 1) {
|
||||
lT = target[target.length - 1];
|
||||
sT = target.slice(0, -1);
|
||||
tN = sT.join(", ") + ` and ${lT}`;
|
||||
} else {
|
||||
if (target.length === 1) tN = target[0];
|
||||
}
|
||||
let ss;
|
||||
if (tN) {
|
||||
ss = name.endsWith("s") ? name + "es" : name + "s";
|
||||
const aT = `${shoot.displayName} ${ss} ${tN} ${tN.endsWith(" times LMFAO") ? "" : endsaT}`,
|
||||
count = shoot.user.interactions[name] + (iC > 0 ? 1 : 0),
|
||||
emb = defaultImageEmbed(msg, await fetchNeko(name));
|
||||
let num;
|
||||
if (count) {
|
||||
const u = count?.toString();
|
||||
if (u?.endsWith("1") && !u.endsWith("11")) {
|
||||
num = count + "st";
|
||||
} else {
|
||||
if (u?.endsWith("2") && !u.endsWith("12")) {
|
||||
num = count + "nd";
|
||||
} else {
|
||||
if (u?.endsWith("3") && !u.endsWith("13")) {
|
||||
num = count + "rd";
|
||||
} else {
|
||||
num = count + "th";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
shoot.user.interactions[name] = 1;
|
||||
num = "First";
|
||||
}
|
||||
shoot.user.interactions[name] += iC;
|
||||
shoot.user.setInteractions(shoot.user.interactions);
|
||||
emb.setAuthor(aT.length > 256 ? `${shoot.displayName} ${ss} so many friends ❤️❤️❤️` : aT, shoot.user.displayAvatarURL({ size: 128, format: "png", dynamic: true }))
|
||||
.setFooter((emb.footer.text ? emb.footer.text + "・" : "") + num + ` ${name} from ` + shoot.displayName + " ❤️");
|
||||
return emb;
|
||||
} else {
|
||||
return "ERROR 404 partner not found <:yeLife:796401669188354090>";
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,8 @@ module.exports = class UnknownCommandCommand extends Command {
|
|||
|
||||
// eslint-disable-next-line
|
||||
async run(msg) {
|
||||
if (/^<@\!?\d{17,19}>\s.+/.test(msg.content)) {
|
||||
if (msg.guild && !msg.member.hasPermission("MANAGE_MESSAGES")) return;
|
||||
if (new RegExp("^<@\!?" + msg.client.user.id + ">\s").test(msg.content)) {
|
||||
msg.channel.startTyping();
|
||||
const s = msg.cleanContent.slice((msg.guild ? msg.guild.member(msg.client.user).displayName.length : msg.client.user.username.length) + 2).trim();
|
||||
return trySend(msg.client, msg, await chatAnswer(s));
|
||||
|
|
|
|||
|
|
@ -183,7 +183,10 @@ async function trySend(client, msgOrChannel, content, checkAd = true) {
|
|||
}*/
|
||||
if (!client || !msgOrChannel || !content) return;
|
||||
if (typeof msgOrChannel === "string") msgOrChannel = client.channels.cache.get(msgOrChannel);
|
||||
if (!client.user.typingIn(msgOrChannel.channel || msgOrChannel)) (msgOrChannel.channel || msgOrChannel).startTyping();
|
||||
if (!client.user.typingIn(msgOrChannel.channel || msgOrChannel)) {
|
||||
console.log("TRYSEND: STARTING TYPING");
|
||||
(msgOrChannel.channel || msgOrChannel).startTyping();
|
||||
}
|
||||
if (client.owners.includes(msgOrChannel.author)) {
|
||||
checkAd = false;
|
||||
if (content.disableMentions) content.disableMentions = "none";
|
||||
|
|
@ -197,7 +200,14 @@ async function trySend(client, msgOrChannel, content, checkAd = true) {
|
|||
}
|
||||
if (!((msgOrChannel instanceof Message) || (msgOrChannel instanceof TextChannel) || (msgOrChannel instanceof DMChannel))) return errLog(e, null, client, false, "[TRYSEND] Invalid {msgOrChannel} type.```js\n" + JSON.stringify(msgOrChannel, (k, v) => v ?? undefined, 2) + "```");
|
||||
const ret = await (msgOrChannel.channel || msgOrChannel).send(content).catch(/*msgOrChannel.channel ? noPerm(msgOrChannel) :*/ e => errLog(e, msgOrChannel, client));
|
||||
console.log("TRYSEND: STOPPING TYPING");
|
||||
await (msgOrChannel.channel || msgOrChannel).stopTyping();
|
||||
setTimeout(() => {
|
||||
if (client.user.typingIn(msgOrChannel.channel || msgOrChannel)) {
|
||||
console.log("TRYSEND: STopping TYPING");
|
||||
(msgOrChannel.channel || msgOrChannel).stopTyping();
|
||||
}
|
||||
}, 2000);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue