Releases: BLU-Shack/bfd-simpleapi
v3.0.1 - Minor Fix
v3.0.0 - Bots for Discord Stuff
bfd-simpleapi - v3.0.0
The Super Rushed Thing That Was Probably Too Late!
What's Changed?
- The style of instantiating the Client has changed.
const BFDClient = require('bfd-simpleapi');
const Client = new BFDClient();It is now:
const BFDClient = require('bfd-simpleapi');
const Client = new BFDClient.Client();
// Alternatively:
const { Client: BFDClient } = require('bfd-simpleapi');
const Client = new BFDClient();- Some known features have been removed:
FetchOptions.specifiedClient.isVerifiedand counterpartClient.isVerifiedSelfClient.postWebhookClient.fetchWidget
- Some known features have been renamed/changed.
- All Options Files have moved to a single file that exports multiple options. Reduces file count.
- All Options have been changed from classes to objects; They now make use of the
Object.assign()function available. Client.fetchSelf()->Client.fetchBot(); Theidcan be omitted and will be replaced byClientOptions#botIDClient.fetchUserBots->Client.fetchBotsOfUserClient.setGuilds->Client.postCount
- New
index.d.tsfile for typings!
What's Implemented/New?
Caching
Sometimes you just don't want to fetch that much at all, since it takes a while, and even though there's no ratelimits, you will sometimes want to get something as fast as possible after the first fetch.
Now introducing Caching! Disabled by default, it can be enabled by changing ClientOptions#cache or FetchOptions#cache to true. Bots will be cached to Client.bots, while Users will be cached to Client.users.
Both of these properties utilize @ired_me/red-store, a Map but with additional functions available for use.
Flexible Function Parameters
Hey, you. Yeah, yeah you.
Have you ever been in this situation:
const Client = new BFDClient({ botID: 'str' });
Client.fetchBot(); // This situation, you HAVE to put your bot ID to access options.This was usually where Self commands came in; To aide in for that purpose. HOWEVER, now that they have been eliminated, now the id can be Options too!
It will check if the id property is an object, and if so, make options the id, and id as the botID of ClientOptions.
Client.postOptions(id: string, options?: PostOptions) has a slightly improved interface!
idcan be number (represents the guildCount) or object (represents PostOptions)optionscan be number (represents the guildCount)
What does this mean? If you have botID and botToken in your ClientOptions, your messy, type-long
Client.postCount('1234567890', { guildCount: 2, botToken: 'someToken' });can be limited down to:
Client.postCount(2);In my opinion, that makes things look cleaner.
So here we have it, v3.0.0! Cheers!
Disclaimer: All endpoints requiring tokens, I am unable to test them for I have no bot to work with. Because of this, I request you to Friend/DM me, Earless Cat#8715 (My alt account) so I can get those functions properly functioning as they should be in future releases.
Cheers to bfd-simpleapi! Hopefully the resulting performance is much more readable and cleaner.
New Stuff and Refactors
v2.2.1 - Update Information!
...in no particular order...
New Features
postWebhook(?options)=> Pushes a test webhook post to your bot.options.secret=> The Webhook Secret; Used for Authorization; OverridesClientOptions.secretif any was set. Unsure what that is? Check out the Changes, Reworks, and Refactors.options.userID=> A pretend user ID that had voted.options.botID=> A pretend bot ID that was voted by the user ID.options.votes=> A pretend vote object.
fetchUserBots(userID)=> Fetches all bot IDs a user owns.userID=> The user ID to fetch the bot IDs from.
new FetchError(message)=> An error that occurs when fetching something.message=> The message to output.
Changes, Reworks, and Refactors
ClientOptionsnow has new value:secret- The
secretproperty accepts a webhook secret, which is used for Authorization for.postWebhook()
- The
BotProperty Changes- Now provides a getter,
.url; Returns a URL returning the bot's page on the site. .botproperty now Unenumerable (What the heck is Enumerability).inviteURLand.inviteNoPermswill be used in favor of the new Deprecation,.invite().supportURLand.supportCodewill be used in favor of the new Deprecation,.support().toString()=> Returns the bot's mention text.
- Now provides a getter,
UserProperty Changes- Now provides a getter,
.url; Returns a URL returning the user's page on the site. .userproperty now Unenumerable.toString()=> Returns the user's mention text.
- Now provides a getter,
FetchOptionsnow include astringifyBoolean value.- If set to TRUE,
normalandspecifiedvalues will be overridden to false, and returns the Bot/User mention. stringifyis useless on fetching a widget.
- If set to TRUE,
- Typing: Fixed
PostOptions.guildCount's type defined as String rather than Number. - New Utility Methods
_bufferToObject(buffer)=> Checks whether or not the buffer can be parsed to an object; Boolean; Used forfetchWidget()error purposes._warn(message)=> Outputs red text into the console.
About Deprecations
- Pre-existent deprecations are now removed.
- New Deprecations:
BotClass => The.invite()and.support()functions are now deprecated. Use the new getter properties,.inviteURL/.inviteNoPermsOR.supportURLand.supportCode
v2.1.0 - Node-Fetch Support
New Features and Changes
- The most important, though arguable, feature is that now uses
node-fetch, rather thansnekfetch. - Many functions have been renamed. You can still use the old names, though they are now deprecated.
| Old Names | New Names |
|---|---|
setCount |
setGuilds |
checkVerif |
isVerified |
checkVerifSelf |
isVerifiedSelf |
- The static value for the Base URL is now
.BaseURL - You can now get all classes used in the index with the static value
.Classes .setGuilds()now usesPostOptionsas the first parameter.- To set the guild count, use
.setGuilds({ guildCount: number }) - To override the token, include
{ token: 'OverrideToken' } - To override the bot ID, include
{ botID: 'OverrideBotID' }
- To set the guild count, use
Notes
- The
isVerified()function, as well as its self counterpart, may be removed from usability, though there is no plans at the moment to do so.
v2.0.0 Super Fixes
- Now supports Widgets
- Now includes custom classes
- Now includes better shit
- Now includes JSDoc stuff
- Even more crazy fixes