Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Releases: BLU-Shack/bfd-simpleapi

v3.0.1 - Minor Fix

22 Jan 01:23
d7b7ea3

Choose a tag to compare

3.0.1 Minor Patch

  • The page property for Bots and Users have changed. Now, instead of bots/:id and users/:id for pages, they now use bots/:id and users/:id, since Bots for Discord has deprecated the earlier type.

v3.0.0 - Bots for Discord Stuff

20 Jan 05:16

Choose a tag to compare

bfd-simpleapi - v3.0.0

The Super Rushed Thing That Was Probably Too Late!

What's Changed?

  1. 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();
  1. Some known features have been removed:
  • FetchOptions.specified
  • Client.isVerified and counterpart Client.isVerifiedSelf
  • Client.postWebhook
  • Client.fetchWidget
  1. 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(); The id can be omitted and will be replaced by ClientOptions#botID
  • Client.fetchUserBots -> Client.fetchBotsOfUser
  • Client.setGuilds -> Client.postCount
  1. New index.d.ts file 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!

  • id can be number (represents the guildCount) or object (represents PostOptions)
  • options can 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

09 Nov 02:44
6abe0a5

Choose a tag to compare

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; Overrides ClientOptions.secret if 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

  • ClientOptions now has new value: secret
    • The secret property accepts a webhook secret, which is used for Authorization for .postWebhook()
  • Bot Property Changes
    • Now provides a getter, .url; Returns a URL returning the bot's page on the site.
    • .bot property now Unenumerable (What the heck is Enumerability)
    • .inviteURL and .inviteNoPerms will be used in favor of the new Deprecation, .invite()
    • .supportURL and .supportCode will be used in favor of the new Deprecation, .support()
    • .toString() => Returns the bot's mention text.
  • User Property Changes
    • Now provides a getter, .url; Returns a URL returning the user's page on the site.
    • .user property now Unenumerable
    • .toString() => Returns the user's mention text.
  • FetchOptions now include a stringify Boolean value.
    • If set to TRUE, normal and specified values will be overridden to false, and returns the Bot/User mention.
    • stringify is useless on fetching a widget.
  • 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 for fetchWidget() error purposes.
    • _warn(message) => Outputs red text into the console.

About Deprecations

  • Pre-existent deprecations are now removed.
  • New Deprecations:
    • Bot Class => The .invite() and .support() functions are now deprecated. Use the new getter properties, .inviteURL/.inviteNoPerms OR .supportURL and .supportCode

v2.1.0 - Node-Fetch Support

21 Oct 14:46
fa81706

Choose a tag to compare

New Features and Changes

  • The most important, though arguable, feature is that now uses node-fetch, rather than snekfetch.
  • 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 uses PostOptions as 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' }

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

18 Oct 01:13

Choose a tag to compare

  • Now supports Widgets
  • Now includes custom classes
  • Now includes better shit
  • Now includes JSDoc stuff
  • Even more crazy fixes