mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 23:32:12 +02:00
Remove API Key from what-anime
This commit is contained in:
@@ -73,7 +73,6 @@ UNSPLASH_KEY=
|
||||
USPS_USERID=
|
||||
WATTPAD_KEY=
|
||||
WEBSTER_KEY=
|
||||
WHATANIME_KEY=
|
||||
XIAO_GITHUB_REPO_NAME=
|
||||
XIAO_GITHUB_REPO_USERNAME=
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "119.44.0",
|
||||
"version": "119.44.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user