Added server/user count to stats, fixed message not showing on tenor/large image errors
This commit is contained in:
parent
41c8be04cf
commit
ae8b121d03
5 changed files with 23 additions and 6 deletions
|
@ -58,7 +58,7 @@ class ImageCommand extends Command {
|
||||||
return this.constructor.noImage;
|
return this.constructor.noImage;
|
||||||
} else if (image.type === "large") {
|
} else if (image.type === "large") {
|
||||||
collections.runningCommands.delete(this.message.author.id);
|
collections.runningCommands.delete(this.message.author.id);
|
||||||
return "That image is too large!";
|
return "That image is too large (>= 25MB)! Try using a smaller image.";
|
||||||
} else if (image.type === "tenorlimit") {
|
} else if (image.type === "tenorlimit") {
|
||||||
collections.runningCommands.delete(this.message.author.id);
|
collections.runningCommands.delete(this.message.author.id);
|
||||||
return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
|
return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
|
||||||
|
|
|
@ -57,11 +57,22 @@ class StatsCommand extends Command {
|
||||||
{
|
{
|
||||||
"name": "Shard",
|
"name": "Shard",
|
||||||
"value": this.message.channel.guild ? this.client.guildShardMap[this.message.channel.guild.id] : "N/A",
|
"value": this.message.channel.guild ? this.client.guildShardMap[this.message.channel.guild.id] : "N/A",
|
||||||
|
"inline": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Cluster",
|
"name": "Cluster",
|
||||||
"value": this.cluster,
|
"value": this.cluster,
|
||||||
"inline": true
|
"inline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Servers",
|
||||||
|
"value": collections.stats.guilds ? collections.stats.guilds : `${this.client.guilds.size} (for this cluster only)`,
|
||||||
|
"inline": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Users (approximation)",
|
||||||
|
"value": collections.stats.users ? collections.stats.users : `${this.client.users.size} (for this cluster only)`,
|
||||||
|
"inline": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
2
shard.js
2
shard.js
|
@ -141,7 +141,7 @@ connected_workers ${image.connections.size}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ipc.register("restart", async () => {
|
this.ipc.register("restart", async () => {
|
||||||
await this.bot.editStatus("dnd", {
|
this.bot.editStatus("dnd", {
|
||||||
name: "esmBot is restarting, please stand by."
|
name: "esmBot is restarting, please stand by."
|
||||||
});
|
});
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
|
@ -3,10 +3,9 @@ const logger = require("../logger.js");
|
||||||
const misc = require("../misc.js");
|
const misc = require("../misc.js");
|
||||||
|
|
||||||
const { Pool } = require("pg");
|
const { Pool } = require("pg");
|
||||||
const pool = new Pool({
|
const connection = new Pool({
|
||||||
connectionString: process.env.DB
|
connectionString: process.env.DB
|
||||||
});
|
});
|
||||||
const connection = pool;
|
|
||||||
|
|
||||||
exports.getGuild = async (query) => {
|
exports.getGuild = async (query) => {
|
||||||
return (await connection.query("SELECT * FROM guilds WHERE guild_id = $1", [query])).rows[0];
|
return (await connection.query("SELECT * FROM guilds WHERE guild_id = $1", [query])).rows[0];
|
||||||
|
|
|
@ -30,7 +30,7 @@ const gfycatURLs = [
|
||||||
"giant.gfycat.com"
|
"giant.gfycat.com"
|
||||||
];
|
];
|
||||||
|
|
||||||
const imageFormats = ["image/jpeg", "image/png", "image/webp", "image/gif"];
|
const imageFormats = ["image/jpeg", "image/png", "image/webp", "image/gif", "large"];
|
||||||
const videoFormats = ["video/mp4", "video/webm", "video/mov"];
|
const videoFormats = ["video/mp4", "video/webm", "video/mov"];
|
||||||
|
|
||||||
// gets the proper image paths
|
// gets the proper image paths
|
||||||
|
@ -48,7 +48,14 @@ const getImage = async (image, image2, video, extraReturnTypes, gifv = false) =>
|
||||||
// Note that MP4 conversion requires an ImageMagick build that supports MPEG decoding
|
// Note that MP4 conversion requires an ImageMagick build that supports MPEG decoding
|
||||||
if (process.env.TENOR !== "") {
|
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}`);
|
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) return extraReturnTypes ? "tenorlimit" : null;
|
if (data.status === 429) {
|
||||||
|
if (extraReturnTypes) {
|
||||||
|
payload.type = "tenorlimit";
|
||||||
|
return payload;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
const json = await data.json();
|
const json = await data.json();
|
||||||
payload.path = json.results[0].media[0].gif.url;
|
payload.path = json.results[0].media[0].gif.url;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue