This wiki is all about the use of Jikan package for interacting with the MAL(My Anime List) API and getting the anime, character info from it.
This gives the information as per the result type specified in the custom function and you can make it into an embed like the normal AOI uses. This code is for those who are fans of anime and wanna make such a system but, getting it hard to code. Use this function as I say or you can also edit this if you have experience in DJS and API interacts.
Index config
Before heading to the custom funcs code, we need to config our index.js a little so that instead of cluttering the index with random custom funcs, we do that in a seperate directory(folder). Here, we use a directory named customFunctions.
Here is the thing that you must add in your index, probably towards the end of it.
Custom Function Code
This is split into two parts, anime and manga. We here discuss the anime part only. Also, the basic custom function which both of em needs and that is, the $getID which gets Anime ID from its name.
So, let’s head to the important part AKA the code!
$getID
This function deals with the fetching of anime/manga ID from its name. This also simplifies the code as we don’t need to fetch ID every time to get it’s info. Instead, we use this function alongside the other to fetch ID as other funcs has an anime ID parameter NOT anime name.
$animeInfo
This function deals with fetching the various information of anime from the API as per the parameter passed. It has a total of 2 parameters.
$getCharInfo
This function deals with getting the character info of a specific character in a specific anime passed as parameters or arguments. It has a total of 3 parameters.
And these are the codes you must add in your /customFunctions/ or whatever you call it directory.
Syntax & Tables
Now, let’s know the syntax and other thing on how to use the above functions.
Returns the remaining synopsis if more than 1024 character else, null
url
Returns the URL of anime in MAL website
genre
Returns the genre of anime
image
Returns image of anime
ratings
Returns the rating of anime
episodes
Returns episode count of anime
recommendations
Returns similar anime as the passed one
year
Returns release year of anime
studio
Returns anime studio
trailer
Returns the trailer link of anime
Option
Output
name
Returns the name of character
url
Returns the URL of character in MAL website
image
Returns image of character
nicknames
Returns the nicknames of the character
anime
Returns the anime of which character is part of
description
Returns a short description about the character
role
Returns role of character, either main or supporting
voiceactor
Returns voice actor of character
Error Table
There are two errors which will be most common when making a command out of it and that should be caught. They are Not Found (Anime/Manga) and Anime Character Not Found. I have made error catching for this which can be caught using $onlyIf which makes sure that you won’t see unnecessary AOIErrors while making embeds.