mirror of
https://github.com/MinazukiAmane/Tinasha-Bot.git
synced 2025-03-15 07:55:58 +08:00
add some anime commands
adding some more anime commands still not tested yet
This commit is contained in:
parent
febb665b71
commit
520395167f
@ -20,4 +20,7 @@ WEATHERSTACK_KEY=
|
|||||||
STRANGE_API_KEY=
|
STRANGE_API_KEY=
|
||||||
|
|
||||||
# Required for gemini command (https://aistudio.google.com/app/prompts/new_chat)
|
# Required for gemini command (https://aistudio.google.com/app/prompts/new_chat)
|
||||||
GEMINI_API=
|
GEMINI_API=
|
||||||
|
|
||||||
|
# Required for few anime commands (https://docs.waifu.it)
|
||||||
|
WAIFU_IT_KEY=
|
@ -25,6 +25,9 @@ STRANGE_API_KEY=
|
|||||||
|
|
||||||
# Required for gemini command (https://aistudio.google.com/app/prompts/new_chat)
|
# Required for gemini command (https://aistudio.google.com/app/prompts/new_chat)
|
||||||
GEMINI_API=
|
GEMINI_API=
|
||||||
|
|
||||||
|
# Required for few anime commands (https://docs.waifu.it)
|
||||||
|
WAIFU_IT_KEY=
|
||||||
```
|
```
|
||||||
|
|
||||||
kalau dapet error sama lavaclient plugin coba ganti ```package.json``` yang ada di ```node_modules/@lavaclient/plugin-queue/``` yang awal nya seperti ini:
|
kalau dapet error sama lavaclient plugin coba ganti ```package.json``` yang ada di ```node_modules/@lavaclient/plugin-queue/``` yang awal nya seperti ini:
|
||||||
|
60
package-lock.json
generated
60
package-lock.json
generated
@ -45,7 +45,8 @@
|
|||||||
"string-progressbar": "^1.0.4",
|
"string-progressbar": "^1.0.4",
|
||||||
"table": "^6.8.1",
|
"table": "^6.8.1",
|
||||||
"timestamp-to-date": "^1.1.0",
|
"timestamp-to-date": "^1.1.0",
|
||||||
"twemoji-parser": "^14.0.0"
|
"twemoji-parser": "^14.0.0",
|
||||||
|
"waifu.it": "^1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
@ -942,6 +943,15 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/centra": {
|
||||||
|
"version": "2.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/centra/-/centra-2.7.0.tgz",
|
||||||
|
"integrity": "sha512-PbFMgMSrmgx6uxCdm57RUos9Tc3fclMvhLSATYN39XsDV29B89zZ3KA89jmY0vwSGazyU+uerqwa6t+KaodPcg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"follow-redirects": "^1.15.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/chalk": {
|
"node_modules/chalk": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
@ -1609,6 +1619,12 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eventemitter3": {
|
||||||
|
"version": "4.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
|
||||||
|
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/events": {
|
"node_modules/events": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||||
@ -1930,6 +1946,26 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/follow-redirects": {
|
||||||
|
"version": "1.15.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
|
||||||
|
"integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"debug": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/form-data": {
|
"node_modules/form-data": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||||
@ -3206,6 +3242,18 @@
|
|||||||
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==",
|
"integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/phin": {
|
||||||
|
"version": "3.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/phin/-/phin-3.7.1.tgz",
|
||||||
|
"integrity": "sha512-GEazpTWwTZaEQ9RhL7Nyz0WwqilbqgLahDM3D0hxWwmVDI52nXEybHqiN6/elwpkJBhcuj+WbBu+QfT0uhPGfQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"centra": "^2.7.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/picomatch": {
|
"node_modules/picomatch": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
@ -4289,6 +4337,16 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/waifu.it": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/waifu.it/-/waifu.it-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-INWQnzwXK8124sHKGx/o8mkE5FjsaFVdLnRNs/jzk4Z0vPWGsKE9GYRETPpT6rrO4FdtbBZZE++qMU9ocG7JRg==",
|
||||||
|
"license": "AGPL-3.0",
|
||||||
|
"dependencies": {
|
||||||
|
"eventemitter3": "^4.0.7",
|
||||||
|
"phin": "^3.7.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/webidl-conversions": {
|
"node_modules/webidl-conversions": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
|
||||||
|
@ -60,7 +60,8 @@
|
|||||||
"string-progressbar": "^1.0.4",
|
"string-progressbar": "^1.0.4",
|
||||||
"table": "^6.8.1",
|
"table": "^6.8.1",
|
||||||
"timestamp-to-date": "^1.1.0",
|
"timestamp-to-date": "^1.1.0",
|
||||||
"twemoji-parser": "^14.0.0"
|
"twemoji-parser": "^14.0.0",
|
||||||
|
"waifu.it": "^1.2.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"bufferutil": "^4.0.8",
|
"bufferutil": "^4.0.8",
|
||||||
|
50
src/commands/anime/animefact.js
Normal file
50
src/commands/anime/animefact.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js");
|
||||||
|
const { EMBED_COLORS } = require("@root/config");
|
||||||
|
const Client = require("waifu.it");
|
||||||
|
const api = new Client(process.env.WAIFU_IT_KEY);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("@structures/Command")}
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
name: "animefact",
|
||||||
|
description: "get a random anime fact",
|
||||||
|
enabled: true,
|
||||||
|
category: "ANIME",
|
||||||
|
cooldown: 5,
|
||||||
|
command: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
slashCommand: {
|
||||||
|
enabled: true,
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
|
||||||
|
async messageRun(message) {
|
||||||
|
const embed = await genFact(message.author);
|
||||||
|
await message.safeReply({ embeds: [embed] });
|
||||||
|
},
|
||||||
|
|
||||||
|
async interactionRun(interaction) {
|
||||||
|
const embed = await genFact(interaction);
|
||||||
|
await interaction.followUp({ embeds: [embed] });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const genFact = async (user) => {
|
||||||
|
try {
|
||||||
|
const data = await api.getFact();
|
||||||
|
return new EmbedBuilder()
|
||||||
|
.setTitle("Anime Fact:")
|
||||||
|
.setDescription(`${data.fact}`)
|
||||||
|
.setColor("Random")
|
||||||
|
.setThumbnail("https://tenor.com/view/anime-idea-i-have-a-plan-i-have-an-idea-gif-14108957")
|
||||||
|
.setFooter({ text: `Requested by ${user.user.username}` });
|
||||||
|
} catch (ex) {
|
||||||
|
return new EmbedBuilder()
|
||||||
|
.setColor(EMBED_COLORS.ERROR)
|
||||||
|
.setDescription("Failed to fetch. Try again!")
|
||||||
|
.setFooter({ text: `Requested by ${user.user.username}` });
|
||||||
|
}
|
||||||
|
};
|
49
src/commands/anime/animequote.js
Normal file
49
src/commands/anime/animequote.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js");
|
||||||
|
const { EMBED_COLORS } = require("@root/config");
|
||||||
|
const Client = require("waifu.it");
|
||||||
|
const api = new Client(process.env.WAIFU_IT_KEY);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("@structures/Command")}
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
name: "animequote",
|
||||||
|
description: "get a radom anime quote",
|
||||||
|
enabled: true,
|
||||||
|
category: "ANIME",
|
||||||
|
cooldown: 5,
|
||||||
|
command: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
slashCommand: {
|
||||||
|
enabled: true,
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
|
||||||
|
async messageRun(message) {
|
||||||
|
const embed = await genQuote(message.author);
|
||||||
|
await message.safeReply({ embeds: [embed] });
|
||||||
|
},
|
||||||
|
|
||||||
|
async interactionRun(interaction) {
|
||||||
|
const embed = await genQuote(interaction);
|
||||||
|
await interaction.followUp({ embeds: [embed] });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const genQuote = async (user) => {
|
||||||
|
try {
|
||||||
|
const data = await api.getQuote();
|
||||||
|
return new EmbedBuilder()
|
||||||
|
.setTitle(`${data.author} said:`)
|
||||||
|
.setDescription(`${data.quote}`)
|
||||||
|
.setColor("Random")
|
||||||
|
.setFooter({ text: `Anime: ${data.anime}` });
|
||||||
|
} catch (ex) {
|
||||||
|
return new EmbedBuilder()
|
||||||
|
.setColor(EMBED_COLORS.ERROR)
|
||||||
|
.setDescription("Failed to fetch. Try again!")
|
||||||
|
.setFooter({ text: `Requested by ${user.user.username}` });
|
||||||
|
}
|
||||||
|
};
|
50
src/commands/anime/waifu.js
Normal file
50
src/commands/anime/waifu.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
const { EmbedBuilder } = require("discord.js");
|
||||||
|
const { EMBED_COLORS } = require("@root/config");
|
||||||
|
const Client = require("waifu.it");
|
||||||
|
const api = new Client(process.env.WAIFU_IT_KEY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import("@structures/Command")}
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
name: "waifu",
|
||||||
|
description: "get a anime waifu",
|
||||||
|
enabled: true,
|
||||||
|
category: "ANIME",
|
||||||
|
cooldown: 5,
|
||||||
|
command: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
slashCommand: {
|
||||||
|
enabled: true,
|
||||||
|
options: [],
|
||||||
|
},
|
||||||
|
|
||||||
|
async messageRun(message) {
|
||||||
|
const embed = await genWaifu(message.author);
|
||||||
|
await message.safeReply({ embeds: [embed] });
|
||||||
|
},
|
||||||
|
|
||||||
|
async interactionRun(interaction) {
|
||||||
|
const embed = await genWaifu(interaction);
|
||||||
|
await interaction.followUp({ embeds: [embed] });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const genWaifu = async (user) => {
|
||||||
|
try {
|
||||||
|
const waifu = await api.getWaifu();
|
||||||
|
return new EmbedBuilder()
|
||||||
|
.setTitle(waifu.name.full)
|
||||||
|
.setDescription(`Anime: ${waifu.media.nodes[0].title.romaji}`)
|
||||||
|
.setImage(waifu.image.large)
|
||||||
|
.setColor("Random")
|
||||||
|
.setFooter({ text: `❤️ ${waifu.favourites}` });
|
||||||
|
} catch (ex) {
|
||||||
|
return new EmbedBuilder()
|
||||||
|
.setColor(EMBED_COLORS.ERROR)
|
||||||
|
.setDescription("Failed to fetch. Try again!")
|
||||||
|
.setFooter({ text: `Requested by ${user.user.username}` });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user