Remove API Key from what-anime

This commit is contained in:
Dragon Fire
2020-11-19 19:56:01 -05:00
parent b3e9003385
commit 4c3078207f
4 changed files with 3 additions and 9 deletions
-1
View File
@@ -73,7 +73,6 @@ UNSPLASH_KEY=
USPS_USERID=
WATTPAD_KEY=
WEBSTER_KEY=
WHATANIME_KEY=
XIAO_GITHUB_REPO_NAME=
XIAO_GITHUB_REPO_USERNAME=
-1
View File
@@ -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
+2 -6
View File
@@ -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 {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "119.44.0",
"version": "119.44.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {