From 4c3078207f1f01ab6f912b90d917e7ea8b91803a Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 19 Nov 2020 19:56:01 -0500 Subject: [PATCH] Remove API Key from what-anime --- .env.example | 1 - README.md | 1 - commands/analyze/what-anime.js | 8 ++------ package.json | 2 +- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index ec90546a..f7a8ee71 100644 --- a/.env.example +++ b/.env.example @@ -73,7 +73,6 @@ UNSPLASH_KEY= USPS_USERID= WATTPAD_KEY= WEBSTER_KEY= -WHATANIME_KEY= XIAO_GITHUB_REPO_NAME= XIAO_GITHUB_REPO_USERNAME= diff --git a/README.md b/README.md index 01ad2fd2..32c12900 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,6 @@ API. All are free unless otherwise stated. * `USPS_USERID` can be obtained at the [Web Tools API Portal](https://www.usps.com/business/web-tools-apis/). * `WATTPAD_KEY` can be obtained at the [Wattpad developer portal](https://www.wattpad.com/developer/docs/api). * `WEBSTER_KEY` can be obtained by [going to the Dictionary API website](https://dictionaryapi.com/). Find the "GET STARTED USING OUR API" section. -* `WHATANIME_KEY` can be obtained by [following these instructions](https://soruly.github.io/trace.moe/#/#rate-limit-and-search-quota). You'll need to email the developer to get an API key. * `XIAO_GITHUB_REPO_NAME` and `XIAO_GITHUB_REPO_USERNAME` are just the username and name of Xiao's repo on GitHub. For example, `dragonfire535` for the username and `xiao` for the name. ### Imgur Album IDs diff --git a/commands/analyze/what-anime.js b/commands/analyze/what-anime.js index a4ab2b5d..4671aac0 100644 --- a/commands/analyze/what-anime.js +++ b/commands/analyze/what-anime.js @@ -3,7 +3,6 @@ const request = require('node-superfetch'); const { createCanvas, loadImage } = require('canvas'); const { stripIndents } = require('common-tags'); const { base64 } = require('../../util/Util'); -const { WHATANIME_KEY } = process.env; module.exports = class WhatAnimeCommand extends Command { constructor(client) { @@ -48,7 +47,7 @@ module.exports = class WhatAnimeCommand extends Command { const title = `${result.title}${result.episode ? ` episode ${result.episode}` : ''}`; return msg.reply(stripIndents` I'm ${result.prob}% sure this is from ${title}. - ${result.prob < 90 ? '_This probablity is rather low, try using a higher quality image._' : ''} + ${result.prob < 87 ? '_This probablity is rather low, try using a higher quality image._' : ''} `, result.preview ? { files: [{ attachment: result.preview, name: 'preview.mp4' }] } : {}); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); @@ -57,9 +56,7 @@ module.exports = class WhatAnimeCommand extends Command { async fetchRateLimit() { try { - const { body } = await request - .get('https://trace.moe/api/me') - .query({ token: WHATANIME_KEY }); + const { body } = await request.get('https://trace.moe/api/me'); return { status: body.quota > 0, refresh: body.quota_ttl }; } catch { return { status: false, refresh: Infinity }; @@ -70,7 +67,6 @@ module.exports = class WhatAnimeCommand extends Command { if (Buffer.byteLength(file) > 1e+7) return 'size'; const { body } = await request .post('https://trace.moe/api/search') - .query({ token: WHATANIME_KEY }) .attach('image', base64(file)); const data = body.docs[0]; return { diff --git a/package.json b/package.json index fb77a490..ae585968 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.44.0", + "version": "119.44.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {