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

Commit 3511058

Browse files
authored
Merge pull request #44 from ntm-development/dev
Simple Ship and noAnime param (GIF)
2 parents 2cf5fb7 + 09bcdf2 commit 3511058

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

assets/generators/twoImages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"amogus",
1515
"sus",
1616
"startedgoing",
17-
"rtx"
17+
"rtx",
18+
"simpleship"
1819
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weeby-js",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "JavaScript Wrapper for Weeby API",
55
"main": "src/index.js",
66
"scripts": {

src/lib/gif.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ class GIF {
2727
/**
2828
* Returns a random GIF image of the type provided.
2929
* @param {string} type - The Type of GIF. See https://weebyapi.xyz/api/docs#gif for all the GIFs.
30+
* @param {string} noanime - EXPERIMENT - IT MAY GET REMOVED: If the GIF should not be anime.
3031
* @returns {Promise<string>} The Formatted GIF URL.
3132
*/
32-
async fetch(type) {
33+
async fetch(type, noanime = '') {
3334
if (typeof type !== 'string') throw new Error(`${chalk.magenta('Weeby-JS')} ${chalk.gray('»')} ${chalk.yellow('The Type parameter is not a string.')}`);
3435
if (!type) throw new Error(`${chalk.magenta('Weeby-JS')} ${chalk.gray('»')} ${chalk.yellow('Type parameter is missing. You will need to provide the type of GIF.')}`);
36+
if (noanime && typeof noanime !== 'boolean') throw new Error(`${chalk.magenta('Weeby-JS')} ${chalk.gray('»')} ${chalk.yellow('The No Anime parameter is not a boolean.')}`);
3537

36-
const { body } = await get(`${this.baseURL}/${type}`)
38+
const { body } = await get(`${this.baseURL}/${type}?noanime=${noanime}`)
3739
.set('Authorization', `Bearer ${this.token}`)
3840
.set('User-Agent', `Weeby-JS by NTM Development » v${version}`);
3941

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const WeebyAPI = require('../src/index');
55
const weeby = new WeebyAPI(process.env.WEEBYAPI);
66

77
(async () => {
8-
const translatedResponse = await weeby.utility.translate({ from: 'en', to: 'fr', text: 'Hello World' });
8+
const hugResponse = await weeby.gif.fetch('hug', true);
99

10-
console.log(translatedResponse);
10+
console.log(hugResponse);
1111
})();

typings/lib/gif.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ declare class GIF {
1919
/**
2020
* Returns a random GIF image of the type provided.
2121
* @param {string} type - The Type of GIF. See https://weebyapi.xyz/api/docs#gif for all the GIFs.
22+
* @param {string} noanime - EXPERIMENT - IT MAY GET REMOVED: If the GIF should not be anime.
2223
* @returns {Promise<string>} The Formatted GIF URL.
2324
*/
2425
fetch(type: string): Promise<string>;

0 commit comments

Comments
 (0)