Search group updates

This commit is contained in:
lilyissillyyy
2025-08-30 14:52:46 -04:00
parent 0db7f24da1
commit aceda67899
6 changed files with 16 additions and 80 deletions
+1 -5
View File
@@ -108,7 +108,7 @@ things, I'm not taking any chances.
19. Start Xiao up!
## Commands
Total: 514
Total: 513
### Utility:
@@ -273,7 +273,6 @@ Total: 514
* **define:** Defines a word.
* **frinkiac:** Input a line from the Simpsons to get the episode/season.
* **github:** Responds with information on a GitHub repository.
* **google:** Searches Google.
* **google-autofill:** Responds with a list of the Google Autofill results for a particular query.
* **gravatar:** Responds with the Gravatar for an email.
* **http-cat:** Responds with a cat for an HTTP status code.
@@ -708,7 +707,6 @@ Total: 514
* [font-finder](https://www.npmjs.com/package/font-finder)
* [gifencoder](https://www.npmjs.com/package/gifencoder)
* [gm](https://www.npmjs.com/package/gm)
* [googlethis](https://www.npmjs.com/package/googlethis)
* [html-entities](https://www.npmjs.com/package/html-entities)
* [image-to-ascii](https://www.npmjs.com/package/image-to-ascii)
* [ioredis](https://www.npmjs.com/package/ioredis)
@@ -902,8 +900,6 @@ Total: 514
- [Frinkiac](https://frinkiac.com/) (API)
* **github:**
- [GitHub](https://github.com/) ([API](https://developer.github.com/v3/))
* **google:**
- [Google](https://www.google.com/) (Search Results)
* **google-autofill:**
- [Google](https://www.google.com/) (Autofill API)
* **gravatar:**
-45
View File
@@ -1,45 +0,0 @@
const Command = require('../../framework/Command');
const google = require('googlethis');
const { stripIndents } = require('common-tags');
module.exports = class GoogleCommand extends Command {
constructor(client) {
super(client, {
name: 'google',
aliases: ['google-this', 'search'],
group: 'search',
description: 'Searches Google.',
credit: [
{
name: 'Google',
url: 'https://www.google.com/',
reason: 'Search Results'
}
],
args: [
{
key: 'query',
type: 'string'
}
]
});
}
async run(msg, { query }) {
const { results } = await google.search(query, {
page: 0,
safe: !msg.channel.nsfw,
parse_ads: false,
additional_params: {
hl: 'en'
}
});
if (!results.length) return msg.reply('Could not find any results.');
const result = results[0];
return msg.reply(stripIndents`
**${result.title}**
${result.description}
<${result.url}>
`);
}
};
+6 -2
View File
@@ -46,9 +46,13 @@ module.exports = class KnowYourMemeCommand extends Command {
async search(query) {
const { text } = await request
.get('https://knowyourmeme.com/search')
.query({ q: query });
.query({
q: query,
sort: 'views',
context: 'entries'
});
const $ = cheerio.load(text);
const location = $('.entry-grid-body').find('tr td a').first().attr('href');
const location = $('section[class="gallery"]').find('a[class="item"]').first().attr('href');
if (!location) return null;
return location;
}
+4 -19
View File
@@ -1,25 +1,16 @@
const Command = require('../../framework/Command');
const { PermissionFlagsBits } = require('discord.js');
const request = require('node-superfetch');
const { createCanvas, loadImage } = require('@napi-rs/canvas');
const path = require('path');
const { createCanvas } = require('@napi-rs/canvas');
const colors = {
Solid: 'black',
Liquid: 'blue',
Gas: 'green'
};
const batman = {
name: 'Batman',
atomic_mass: 5.736e+28,
number: 0,
period: 'Gotham City',
phase: 'Solid',
symbol: '🦇'
};
const jerktonium = {
name: 'Jerktonium',
atomic_mass: 240,
number: 1999,
atomic_mass: 1999,
number: 0,
period: 'Bikini Bottom',
phase: 'Solid',
symbol: 'Jt'
@@ -86,21 +77,16 @@ module.exports = class PeriodicTableCommand extends Command {
ctx.fillStyle = 'white';
ctx.fillRect(10, 10, canvas.width - 20, canvas.height - 20);
ctx.textAlign = 'center';
if (element.number === 0) {
const batmanImg = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'batman.png'));
ctx.drawImage(batmanImg, 100, 166);
} else {
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(210);
ctx.fillStyle = colors[element.phase] || 'gray';
ctx.fillText(element.symbol, 250, 320);
}
ctx.fillStyle = 'black';
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(45);
ctx.fillText(element.number.toString(), 250, 100);
ctx.fillText(element.name, 250, 450);
ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(30);
ctx.fillText(element.atomic_mass ? element.atomic_mass.toString() : '?', 250, 400);
const period = element.number === 0 || element.number === 1999
const period = element.number === 0
? element.period
: `period ${element.period}`;
const phase = element.undiscovered ? `hypothetical ${element.phase || 'element'}` : element.phase;
@@ -115,7 +101,6 @@ module.exports = class PeriodicTableCommand extends Command {
const { text } = await request
.get('https://raw.githubusercontent.com/Bowserinator/Periodic-Table-JSON/master/PeriodicTableJSON.json');
this.table = JSON.parse(text).elements;
this.table.unshift(batman);
this.table.unshift(jerktonium);
return this.table;
}
+1 -4
View File
@@ -39,10 +39,7 @@ module.exports = class YuGiOhCommand extends Command {
try {
const { body } = await request
.get('https://db.ygoprodeck.com/api/v7/cardinfo.php')
.query({
fname: card,
la: 'english'
});
.query({ fname: card });
const data = body.data[0];
const embed = new EmbedBuilder()
.setColor(0xBE5F1F)
+1 -2
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "154.0.0",
"version": "155.0.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
@@ -53,7 +53,6 @@
"font-finder": "^1.1.0",
"gifencoder": "^2.0.1",
"gm": "^1.25.1",
"googlethis": "github:CROSP/google-this",
"html-entities": "^2.6.0",
"image-to-ascii": "^3.2.2",
"ioredis": "^5.7.0",