# Getting Started

NOTE

Any entity can have partial data, so before performing any activity use the fetch() method to obtain all the information pertaining to the entity

# First, create you client

const FakeYou = require('fakeyou.js');
const fy = new FakeYou.Client(<ClientOptions>);
//Client

ClientOptions are optional parameters to create a Client, you can leave it blank or add your data, either your credentials to login to a FakeYou account or your authorization token.

It's recommended to set account credentials, so that any generated TTSResult will belong to that account and can be accessible later. The authorization token is given to users by the administrative staff of FakeYou from their Discord server to bypass rate limiting as well as access your privately uploaded models.

# Now, go to start

await fy.start()

The start() method is required before performing any activity in fakeyou.js, technically what it does is to request to API the list of public categories and models and store them in cache, and login with the account credentials if they provided.

# Choose a model

const model = fy.models.cache.get('TM:7wbtjphx8h8v');
//Model
const searchedModels = fy.searchModel('mario');
//Search for models that include title "mario"
let model = searchedModels.first()
//Get the first value of [Group]

The list of models can be found in the ModelManager cache, to choose a model just search for it by token, or use the searchModel() method to search for it by title/name.

If you use the search model method, it will return a Group, an extended Map based on discord.js collection, just find() the choosen one by other parameters like language, category parent or just uses first() method to get the first value

# Making your first TTS result

const result = await model.request('A cool text to speech');
const result = await fy.makeTTS(<ModelResolvable>, 'A cool text to speech');
//Shorcut method but inestable

You got your choosen model, now create your TTS result by giving it a text to make it "speech". Just use the request() method

Alternatively, the client has the makeTTS() shortcut method, just provide the model resolvable and text, but unfortunately, if you define the model title/name, you are not sure you will get the desired model.

# How can i get my result?

result.audioURL();
//Get file audio URL
await result.getAudio();
//Buffer of wav audio

Congrats, you had been created your first request, to get the audio file just use audioURL() or the file buffer with getAudio(), Also you can access to more data like text and model used, duration and size result, etc.

INFO

This is an example of the use of the package, you can use any of the methods and objects for your project, why don't we start with Client?, the main hub of fakeyou.js