Fix help pages, do not read delay from tenor MP4s, update packages
This commit is contained in:
parent
0de069a41f
commit
ff589d11c9
6 changed files with 782 additions and 1012 deletions
Binary file not shown.
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 237 KiB |
1759
package-lock.json
generated
1759
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -29,8 +29,8 @@
|
|||
"cowsay2": "^2.0.4",
|
||||
"dotenv": "^16.0.0",
|
||||
"emoji-regex": "^10.0.0",
|
||||
"eris": "^0.16.1",
|
||||
"eris-fleet": "^1.0.1",
|
||||
"eris": "github:DonovanDMC/eris#everything",
|
||||
"eris-fleet": "^1.0.2",
|
||||
"file-type": "^17.1.1",
|
||||
"format-duration": "^1.4.0",
|
||||
"jsqr": "^1.3.1",
|
||||
|
|
|
@ -17,13 +17,14 @@ export async function generateList() {
|
|||
const description = info.get(command).description;
|
||||
const params = info.get(command).params;
|
||||
if (category === "tags") {
|
||||
const subCommands = [...Object.keys(description)];
|
||||
const subCommands = info.get(command).flags;
|
||||
categories.tags.push(`**tags** ${params.default} - ${description}`);
|
||||
for (const subCommand of subCommands) {
|
||||
categories.tags.push(`**tags${subCommand !== "default" ? ` ${subCommand}` : ""}**${params[subCommand] ? ` ${params[subCommand]}` : ""} - ${description[subCommand]}`);
|
||||
categories.tags.push(`**tags ${subCommand.name}**${params[subCommand.name] ? ` ${params[subCommand.name].join(" ")}` : ""} - ${subCommand.description}`);
|
||||
}
|
||||
} else {
|
||||
if (!categories[category]) categories[category] = [];
|
||||
categories[category].push(`**${command}**${params ? ` ${params}` : ""} - ${description}`);
|
||||
categories[category].push(`**${command}**${params ? ` ${params.join(" ")}` : ""} - ${description}`);
|
||||
}
|
||||
}
|
||||
generated = true;
|
||||
|
|
|
@ -3,16 +3,6 @@ import WebSocket from "ws";
|
|||
import * as logger from "./logger.js";
|
||||
import { setTimeout } from "timers/promises";
|
||||
|
||||
/*
|
||||
Rerror 0x01
|
||||
Tqueue 0x02
|
||||
Rqueue 0x03
|
||||
Tcancel 0x04
|
||||
Rcancel 0x05
|
||||
Twait 0x06
|
||||
Rwait 0x07
|
||||
Rinit 0x08
|
||||
*/
|
||||
const Rerror = 0x01;
|
||||
const Tqueue = 0x02;
|
||||
const Rqueue = 0x03;
|
||||
|
@ -30,7 +20,7 @@ class ImageConnection {
|
|||
}
|
||||
this.host = host;
|
||||
this.auth = auth;
|
||||
this.tag = null;
|
||||
this.tag = 0;
|
||||
this.disconnected = false;
|
||||
this.njobs = 0;
|
||||
this.max = 0;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import fetch from "node-fetch";
|
||||
import { getType } from "./image.js";
|
||||
import { exec } from "child_process";
|
||||
import { promisify } from "util";
|
||||
const execPromise = promisify(exec);
|
||||
|
||||
const tenorURLs = [
|
||||
"tenor.com",
|
||||
|
@ -47,8 +44,7 @@ const getImage = async (image, image2, video, extraReturnTypes, gifv = false) =>
|
|||
const host = new URL(image2).host;
|
||||
if (tenorURLs.includes(host)) {
|
||||
// Tenor doesn't let us access a raw GIF without going through their API,
|
||||
// so we use that if there's a key in the config and fall back to using the MP4 if there isn't
|
||||
// Note that MP4 conversion requires an ImageMagick build that supports MPEG decoding
|
||||
// so we use that if there's a key in the config
|
||||
if (process.env.TENOR !== "") {
|
||||
const data = await fetch(`https://g.tenor.com/v1/gifs?ids=${image2.split("-").pop()}&media_filter=minimal&limit=1&key=${process.env.TENOR}`);
|
||||
if (data.status === 429) {
|
||||
|
@ -62,9 +58,6 @@ const getImage = async (image, image2, video, extraReturnTypes, gifv = false) =>
|
|||
const json = await data.json();
|
||||
if (json.error) throw Error(json.error);
|
||||
payload.path = json.results[0].media[0].gif.url;
|
||||
} else {
|
||||
const delay = (await execPromise(`ffprobe -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate ${image}`)).stdout.replace("\n", "");
|
||||
payload.delay = (100 / delay.split("/")[0]) * delay.split("/")[1];
|
||||
}
|
||||
} else if (giphyURLs.includes(host)) {
|
||||
// Can result in an HTML page instead of a GIF
|
||||
|
@ -133,7 +126,8 @@ export default async (client, cmdMessage, interaction, options, extraReturnTypes
|
|||
// we can get a raw attachment or a URL in the interaction itself
|
||||
if (options) {
|
||||
if (options.image) {
|
||||
const result = await getImage(interaction.data.resolved.attachments[options.image].proxy_url, interaction.data.resolved.attachments[options.image].url, video);
|
||||
const attachment = interaction.data.resolved.attachments.get(options.image);
|
||||
const result = await getImage(attachment.proxyUrl, attachment.url, video);
|
||||
if (result !== false) return result;
|
||||
} else if (options.link) {
|
||||
const result = await getImage(options.link, options.link, video);
|
||||
|
|
Loading…
Reference in a new issue