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

Releases: BLU-Shack/simple.space

simple.space v3.2.0 Updates

06 Feb 03:31
854f8b0
Compare
Choose a tag to compare

simple.space - v3.2.0

What's Changed?

  1. MultiFetchOptions has been updated to support new Query Parameters added for v1/bots

As of 2/2/19, there has been 2 new query parameters added to the botlist.space API:
reverseSort and sortBy.

  • sortBy will take a raw bot object's property and sort it through that property.
  • reverseSort will require sortBy have value. When set to true, it will reverse the sorted return value.

EXAMPLE: sortBy is now given a value called server_count. The returned value of the API will output an array of bots that are sorted by bots with greatest server count to least server count. Output Example: [5, 2, 1, null, null] (Some bots do not POST their own number of servers they are in)

EXAMPLE 2: sortBy still has server_count as its value, but the user has decided to make reverseSort true. This resulted in the sorting of bots be made with bots that have server counts from least to greatest. Output Example: [null, null, 1, 2, 5]

  1. Options are not longer exported from the module.

This was before when it was intended for the src/structures/index.js file to export options. Now that the file has been removed and direct requires from each file is now required, they are no longer exported; An unintended side effect that was planned to be removed later.

  1. createdTimestamp for both Bot and Stats classes

The createdAt property before was the Timestamp; Now it is the Date, with createdTimestamp for the timestamp.

  1. The Tests have been updated.

    • No longer has userToken in the Options
    • Timeouts are longer
    • Included Statistics Test.
  2. Legend has it the index.d.ts file has been updated to goodiness.


What's Implemented/New?

Option Checking

Now all options will be checked of their properties each time a fetch or a post is performed.


Minor Notes

Optimizations

  • .get() and .authGet() - The headers param is now an object.
  • userToken is no longer mapped out from ClientOptions to all other options.
    • If you did not know, ClientOptions.botToken, .version, and .cache all become the defaults of FetchOptions, MultiFetchOptions, and PostOptions. userToken seemingly stayed there, so it was removed from its use.
  • JSDoc userToken in MultiFetchOptions no longer appears.
  • .postCount() in Typings now uses (id?: string, options?: PostOptions) as priority override.
  • index.js files of both structures/ and util/ directories have been removed. Direct requires are now performed in the files.
  • If userToken appears in ClientOptions, FetchOptions, or MultiFetchOptions, a Deprecation Warning will be emitted, as they are now obsolete in the API and have no use.
  • The Errors/FetchError and /Ratelimit both have been unified into a single errors.js file in the structures/ folder.
  • isObject.js is no longer in its own file.

Bug Fixes

  • fetchUpvotes() - Used .get() instead of authGet() - Rendered unusable.

Deprecations

  • fetchAllBots() - Pending Removal in Next Minor/Major Update

v3.0.0 - v4 Goodies

01 Jan 19:07
eb3a732
Compare
Choose a tag to compare
  • Basically a lot of shit

v2.3.1 Update Notes (Patch)

26 Nov 03:48
0e2f299
Compare
Choose a tag to compare
IN NO PARTICULAR ORDER!!!

Time of release: 2018-11-25

Generally fixes some bugs and added a little bit of extra things.

  • Stats.combined - Fixed outputting NaN
  • The post event now includes a second parameter including the count posted.

v2.3.0 - Cache n' Events

25 Nov 01:03
Compare
Choose a tag to compare
IN NO PARTICULAR ORDER!!!

Time of release: 2018-11-25

Main Part of the Update

  • index.d.ts is now a thing. That's cool I guess.
  • ClientOptions now has cache and cacheUpdateTimer parameters!
    • What does this mean? You will no longer have to asynchronously fetch a bot/emoji/guild.
    • To use, set cache: true, and if desired, cacheUpdateTimer: [Number], Number being the # of milliseconds to wait for each automatic cache update; Defaults to 180000 (3 minutes; Set it as 0 to disable)
    • Because this.bots, this.emojis, and this.guilds won't be ready right on initialization, you'll be given new events.
    • Anytime you fetch something, it is automatically cached.
  • Every New Event:
    • ready => When the first cache is updated, or it was never updated. Runs regardless of which.
    • cacheUpdateAll => When all of the cache is updated.
    • cacheUpdateBots => Emitted when this.bots is updated.
    • cacheUpdateEmojis => Emitted when this.emojis is updated.
    • cacheUpdateGuilds => Emitted with this.guilds is updated.
    • post => Emitted when a post action is done.
  • If cache is true, anytime you fetch a bot, emoji, or guild, it updates itself to their corrosponding Stores.
  • this.bots, this.emojis, and this.guilds all use a new Store class, which is generally a Map but with more methods.
Utilizing Cache and Events
// Returns the bot's username.
Client.on('ready', (bots) => {
    console.log(bots.get('BotID').username);
});
// You do not require the data value, you can call the Client itself.
// Returns each guild name.
Client.on('ready', () => {
    console.log(Client.guilds.map(guild => guild.name).join('\n'));
});
// The total amount of animated listed emojis, which logs each time the emoji cache is updated.
Client.on('cacheUpdateEmojis', (bots, emojis, guilds) => {
    console.log(Client.emojis.filter(e => e.animated).size);
});
// Get the data received when posting.
// Should return "200 Successfully updated server count" into the console.
Client.on('post', info => {
    console.log(`${info.code} ${info.message}`);
});

Recap, Refactors, and Changes

Assumptions:

  • const Space = require('simple.space')

Important Notice: You are now to initiate the Client using new Space.Client()

New Structures

  • Store - Basically a Map, but with extended methods for usage.
  • UpvoteUser - Now, when fetching upvotes a bot has, the responses now have their own class instead of the partially-accepted PartialUser.

Main Features Implemented

Cache
Now synchronously fetch a bot/emoji/guild!
  • ClientOptions accepts new values for use.
    • cache - Whether or not to cache all bots, guilds, and/or emojis.
    • cacheUpdateTimer - The number of milliseconds in which to update the cache. Set to 0 to disable.
  • If cache is set to true, this.bots, .emojis, and .guilds, which are Stores, will be mapped by each respective bot/emoji/guild ID and its contents, and will be updated in an interval/whenever a Fetch is performed.
Events
Partially useful?
  • ready - Emitted when the Client is initiated. If cache is set to true, this will be emitted when cache is complete. If false, this emits when initiated.
  • cacheUpdate - Emitted when ALL of the cache is updated. Works similarly to ready, but emits in a set interval. Never emits if cacheUpdateTimer is set to 0, nor if ClientOptions.cache is configured to false, its default value.
  • cacheUpdateBots - Emitted when any part of this.bots is updated.
  • cacheUpdateEmojis - Emitted when any part of this.emojis is updated.
  • cacheUpdateGuilds - Emitted when any part of this.guilds is updated.
  • post Emitted whenever posting guild count is performed.

Type Fixes/Changes

  • New index.d.ts file
  • Type Fixes where fetching all Bots/Guilds/Emojis claimed to return an array of Bot/Guild/Emoji with no Promise when indeed it would return a Promise. No promises, though.

Function Reworks

  • .fetchUpvotes() now returns an array of UpvoteUsers
  • .hasUpvoted() now accepts an array of strings. If an array of strings is passed in the first parameter, it returns a Store mapped by the user ID and whether or not they had upvoted.
  • .hasUpvoted() now accepts UpvoteFetchOptions as its second parameter, though some values will be ignored, specifically normal, specified, stringify (It was originally intended for stringify to be included as a usable parameter, but contributed to code clutter)
  • .postCount() - Now accepts number as first parameter (Previously discouraged but I felt it was too annoying :p)

Bug Fixes

  • Unsure what to call a bug though...

Deprecations

  • Client.setCount() - Function rename; Now .postCount()

Misc

  • All FetchOptions should now come into use when fetching anything, besides Stats.
  • Space.Classes rework; All classes (and client) now attached to index.js
    • Examples: new Space.Client(), new Space.ClientOptions({}), new Space.Store()

Minor Note: In the future, fetching Bots, Emojis, or Guilds using the fetchAll methods, may return a Store. normal may then have a different use in that case, and FetchOptions will have a new definition regarding getting the plain objects fetched. Not intended, but something to think about.

v2.2.3 New Stuff

04 Nov 15:24
3286861
Compare
Choose a tag to compare

v2.2.3

This update includes a lot of changes.

These are the New Changes...in no particular order...

  • Now uses Node-Fetch instead of snekfetch

  • New (and changed) Classes!
    • PartialUser => This is used whenever a user is fetched from a bot/guild/bot's upvotes, since some values are missing due to circular references.
    • FetchError => A not-very-polished error class that is thrown when an error on the site is occurred.
    • Emoji => Used when fetching a Guild's emojis (also new)
    • PostOptions => Options when posting guild count.
    • UpvoteFetchOptions => Options when fetching for a bot's upvotes.
    • FetchOptions => Now includes .stringify parameter
      • If set to TRUE, returns the stringifed form of Bots/Users (mention), Guilds (name), or Emoji (text-that-transforms-into-a-readable-emoji-for-Discord)
    • NonGuildBase is now dead. Not big soup rice, as Heavy would say.

  • Functions Changed!
    • fetchAll() has now been split.
      • Use fetchAllBots() or fetchAllEmojis()
    • edit() now only returns the new ClientOptions that have been set.
    • fetchEmoji() => Fetch an emoji on the site!
    • fetchGuildEmojis() => Fetches all emojis that a guild has.
    • setGuilds() => Functionality Now Changed.
      • Now wants setGuilds({ guildSize: number | array of numbers })
      • You can now use: setGuilds({ token: 'API_TOKEN', botID: 'BOT_ID' }) so you don't have to supply them on initialization(?)
    • fetchUpvotes() no longer allows to get another bot's because I only figured out now in the past 2 days that you can't fetch other bots' upvotes LOL
      • fetchUpvotes() usage changed. Now use fetchUpvotes({ ids: true }) if you want only user IDs.

Usability?

  • I do not know if the setGuilds or the fetchUpvotes work, since my bot for testing purposes got died...

Woah v2.2.2

15 Oct 21:55
59e5842
Compare
Choose a tag to compare
  • Created a Stats class
  • Changed the log property; If true, logs anything you fetch, like fetching a bot or user, it console logs what it resolves.

Code Refactors

15 Oct 00:43
8d0ee11
Compare
Choose a tag to compare
  • Updated and refactored a heck ton of code.
  • Fixed the README.md lol

Fixed some things

14 Oct 14:15
dd6646c
Compare
Choose a tag to compare
  • Added JSDoc stuff
  • Created a NonGuildBase for both Bot and User.
  • Fixed the setGuilds function.

v2.1.0

13 Oct 17:54
Compare
Choose a tag to compare

Too many reworks! God!

  • Initialization has been updated. You now are to input an object in the options parameter.
  • edit() function has changed. You are now to input an object in the options parameter.
  • Custom-made Bot/Server/User Classes have been created. Super special stuff.
  • Most "specified" parameters have changed. They are now FetchOptions, and are still optional. { normal: false, specified: false } (normal: TRUE if you want it to be not the custom made class, and specified, if you want a specific value)

Minor Notes

  • setCount() is now removed.
  • .fetchAll('servers') is now deprecated; Use 'guilds' instead.

v2.0.0 - The Guilds Update

12 Oct 02:10
Compare
Choose a tag to compare
  • Servers on the site have been introduced, and this update grants support just for Servers! Use fetchGuild(guildID, ?specified) to fetch a guild (server in the API) on the site.
  • Introduced the fetchAll(kind, ?specified) function => Fetches all bots/guilds (supply "servers") that has been submitted onto the site.
  • You can now edit values in the instance with .edit(key, value). Returns itself so you can chain edits.
  • IDs no longer check if the ID length is 18 because that's kind of stupid tbh.

Minor Notes

  • Fixed a couple descriptions as they were slightly confusing.
  • The reason these guilds are named a "Guild" is what Discord calls "guilds" in the API.
  • setCount(serverSize) is now deprecated. Use setGuilds(guildSize) instead. BONUS: Go here to say what you think whether I should revert/change/leave it.