more image commands =>

This commit is contained in:
Neko Life 2021-06-27 22:14:19 +09:00
parent 7a8c2186e6
commit d72dd989f9
10 changed files with 149 additions and 13 deletions

22
cmds/image/baka.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { trySend, defaultImageEmbed } = require("../../resources/functions");
const { default: fetchNeko } = require("nekos-best.js");
module.exports = class baka extends commando.Command {
constructor(client) {
super(client, {
name: "baka",
memberName: "baka",
group: "image",
description: "Say \"baka\" :/"
});
}
async run(msg) {
const title = `${msg.guild ? msg.member.displayName : msg.author.username} is getting dere-dere~ =>`;
const image = await fetchNeko("baka");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
}
};

22
cmds/image/cry.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { trySend, defaultImageEmbed } = require("../../resources/functions");
const { default: fetchNeko } = require("nekos-best.js");
module.exports = class cry extends commando.Command {
constructor(client) {
super(client, {
name: "cry",
memberName: "cry",
group: "image",
description: "Are you sad? :("
});
}
async run(msg) {
const title = `${msg.guild ? msg.member.displayName : msg.author.username} is crying :<`;
const image = await fetchNeko("cry");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
}
};

22
cmds/image/dance.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { trySend, defaultImageEmbed } = require("../../resources/functions");
const { default: fetchNeko } = require("nekos-best.js");
module.exports = class dance extends commando.Command {
constructor(client) {
super(client, {
name: "dance",
memberName: "dance",
group: "image",
description: "Let's dance =]"
});
}
async run(msg) {
const title = `${msg.guild ? msg.member.displayName : msg.author.username} is dancin :>`;
const image = await fetchNeko("dance");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
}
};

22
cmds/image/laugh.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { trySend, defaultImageEmbed } = require("../../resources/functions");
const { default: fetchNeko } = require("nekos-best.js");
module.exports = class laugh extends commando.Command {
constructor(client) {
super(client, {
name: "laugh",
memberName: "laugh",
group: "image",
description: "Show your laugh :D"
});
}
async run(msg) {
const title = `${msg.guild ? msg.member.displayName : msg.author.username} is laughin XD`;
const image = await fetchNeko("laugh");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
}
};

22
cmds/image/smile.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { trySend, defaultImageEmbed } = require("../../resources/functions");
const { default: fetchNeko } = require("nekos-best.js");
module.exports = class smile extends commando.Command {
constructor(client) {
super(client, {
name: "smile",
memberName: "smile",
group: "image",
description: "Show your smile <3"
});
}
async run(msg) {
const title = `${msg.guild ? msg.member.displayName : msg.author.username} is smilin :D`;
const image = await fetchNeko("smile");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
}
};

22
cmds/image/smug.js Normal file
View file

@ -0,0 +1,22 @@
'use strict';
const commando = require("@iceprod/discord.js-commando");
const { trySend, defaultImageEmbed } = require("../../resources/functions");
const { default: fetchNeko } = require("nekos-best.js");
module.exports = class smug extends commando.Command {
constructor(client) {
super(client, {
name: "smug",
memberName: "smug",
group: "image",
description: "Show your smug :]"
});
}
async run(msg) {
const title = `${msg.guild ? msg.member.displayName : msg.author.username} got a smug face >:]`;
const image = await fetchNeko("smug");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
}
};

View file

@ -1,8 +1,8 @@
'use strict'; 'use strict';
const commando = require("@iceprod/discord.js-commando"); const commando = require("@iceprod/discord.js-commando");
const { trySend } = require("../../resources/functions"); const { trySend, defaultImageEmbed } = require("../../resources/functions");
const interactEmbed = require("./interactEmbed"); const { default: fetchNeko } = require("nekos-best.js");
module.exports = class wave extends commando.Command { module.exports = class wave extends commando.Command {
constructor(client) { constructor(client) {
@ -10,11 +10,13 @@ module.exports = class wave extends commando.Command {
name: "wave", name: "wave",
memberName: "wave", memberName: "wave",
group: "image", group: "image",
description: "Wave everyone!", description: "Wave to you friends!"
guildOnly: true
}); });
} }
async run(msg, arg) { async run(msg) {
return trySend(this.client, msg, await interactEmbed(msg, arg, "wave", ":D")); const title = `${msg.guild ? msg.member.displayName : msg.author.username} is waving :)`;
const image = await fetchNeko("wave");
const emb = defaultImageEmbed(msg, image, title);
return trySend(this.client, msg, emb);
} }
}; };

View file

@ -19,7 +19,7 @@ const { CommandoMessage, CommandoClient } = require('@iceprod/discord.js-command
async function errLog(theError, msg, client, sendTheError, errorMessage, notify) { async function errLog(theError, msg, client, sendTheError, errorMessage, notify) {
if (!client && msg) client = msg.client; if (!client && msg) client = msg.client;
if (!(theError instanceof Error) || !client) return console.error("[ERRLOG] Not error instance or no required param:", theError); if (!(theError instanceof Error) || !client) return console.error("[ERRLOG] Not error instance or no required param:", theError);
let [ret, logThis, inLogChannel, sendErr] = [null, '', '', '']; let [ret, logThis, inLogChannel, sendErr] = [undefined, '', '', ''];
if (msg instanceof Message) { if (msg instanceof Message) {
client.emit("commandError", msg.command, theError, msg); client.emit("commandError", msg.command, theError, msg);
logThis = `\`${msg.command?.name}\` (${msg.id}) ${msg.url} in ${msg.guild ? `**${msg.channel.name}** (${msg.channel.id}) of **${msg.guild.name}** (${msg.guild.id})` : `**DM**`} ran by **${msg.author.tag}** (${msg.author.id}) \n\n`; logThis = `\`${msg.command?.name}\` (${msg.id}) ${msg.url} in ${msg.guild ? `**${msg.channel.name}** (${msg.channel.id}) of **${msg.guild.name}** (${msg.guild.id})` : `**DM**`} ran by **${msg.author.tag}** (${msg.author.id}) \n\n`;

View file

@ -14,7 +14,7 @@ module.exports = function getColor(name) {
return name; return name;
} }
} }
switch(name) { switch (name) {
case 'rosy brown': case 'rosy brown':
return 12357519; return 12357519;
case 'magenta': case 'magenta':
@ -56,7 +56,9 @@ module.exports = function getColor(name) {
if (name.startsWith("#")) name = name.slice(1); if (name.startsWith("#")) name = name.slice(1);
return name; return name;
} else { } else {
return parseInt(name, 10); const n = parseInt(name, 10);
if (n >= 16777215) return 16777214;
return n;
} }
} }
} }

View file

@ -74,14 +74,13 @@ module.exports = {
} }
if (u === "r") { if (u === "r") {
if (C.length > 0) { if (C.length > 0) {
for (const a of C) console.log("Resuming session:", a.guild.name, a.guild.id, a.name, a.id); for (let i = 0; i < C.length; i++) console.log("Resuming session:", C[i].guild.name, C[i].guild.id, i + ":", C[i].name, C[i].id);
return client.convo = true; return client.convo = true;
} else return console.log("No previous session"); } else return console.log("No previous session");
} }
if (u === "q") { if (u === "q") {
if (C.length > 0 && client.convo) { if (C.length > 0 && client.convo) {
console.log("Ending sessions:"); for (let i = 0; i < C.length; i++) console.log("Ending session:", C[i].guild.name, C[i].guild.id, i + ":", C[i].name, C[i].id);
for (const a of C) console.log(a.guild.name, a.guild.id, a.name, a.id);
client.convo = false; client.convo = false;
} }
return console.log("Ended"); return console.log("Ended");
@ -100,7 +99,8 @@ module.exports = {
for (let i = 0; i < C.length; i++) console.log(C[i].guild.name, C[i].guild.id, i + ":", C[i].name, C[i].id); for (let i = 0; i < C.length; i++) console.log(C[i].guild.name, C[i].guild.id, i + ":", C[i].name, C[i].id);
} else if (C[num]) return C[num].send(emoteMessage(client, sl ? arg.slice(num?.toString().length).trim() : arg)).catch(console.error); else { } else if (C[num]) return C[num].send(emoteMessage(client, sl ? arg.slice(num?.toString().length).trim() : arg)).catch(console.error); else {
console.log('No session. Available sessions:'); console.log('No session. Available sessions:');
for (const a of C) console.log(a.guild.name, a.guild.id, a.name, a.id); for (let i = 0; i < C.length; i++) console.log(C[i].guild.name, C[i].guild.id, i + ":", C[i].name, C[i].id);
return;
}; };
return client.convo = true; return client.convo = true;
} }