stuff and things
This commit is contained in:
parent
3957b17645
commit
e67c0d96ca
28 changed files with 54 additions and 150 deletions
|
@ -3,7 +3,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class AncientCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
controller.abort();
|
||||
|
|
|
@ -3,7 +3,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class BirdCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
controller.abort();
|
||||
|
|
|
@ -3,7 +3,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class CatCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
controller.abort();
|
||||
|
|
|
@ -3,7 +3,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class DogCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
controller.abort();
|
||||
|
|
|
@ -3,7 +3,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class WikihowCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
controller.abort();
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
import Command from "../../classes/command.js";
|
||||
const mentionRegex = /^<?[@#]?[&!]?(\d+)>?$/;
|
||||
|
||||
class AvatarCommand extends Command {
|
||||
async run() {
|
||||
const member = this.options.member ?? this.args[0];
|
||||
const self = this.client.users.get(this.author) ?? await this.client.rest.users.get(this.author);
|
||||
if (this.type === "classic" && this.message.mentions.users[0]) {
|
||||
return this.message.mentions.users[0].avatarURL(null, 512);
|
||||
} else if (member && member > 21154535154122752n) {
|
||||
const user = this.client.users.get(member) ?? await this.client.rest.users.get(member);
|
||||
if (user) {
|
||||
return user.avatarURL(null, 512);
|
||||
} else if (mentionRegex.test(member)) {
|
||||
const id = member.match(mentionRegex)[1];
|
||||
if (id < 21154535154122752n) {
|
||||
this.success = false;
|
||||
return "That's not a valid mention!";
|
||||
}
|
||||
try {
|
||||
const user = this.client.users.get(id) ?? await this.client.rest.users.get(id);
|
||||
return user.avatarURL(null, 512);
|
||||
} catch {
|
||||
return self.avatarURL(null, 512);
|
||||
}
|
||||
} else {
|
||||
return self.avatarURL(null, 512);
|
||||
}
|
||||
} else if (this.args.join(" ") !== "" && this.guild) {
|
||||
const searched = await this.guild.searchMembers({
|
||||
query: this.args.join(" "),
|
||||
limit: 1
|
||||
});
|
||||
if (searched.length === 0) return self.avatarURL(null, 512);
|
||||
const user = this.client.users.get(searched[0].user.id) ?? await this.client.rest.users.get(searched[0].user.id);
|
||||
return user ? user.avatarURL(null, 512) : self.avatarURL(null, 512);
|
||||
} else {
|
||||
return self.avatarURL(null, 512);
|
||||
}
|
||||
}
|
||||
|
||||
static description = "Gets a user's avatar";
|
||||
static aliases = ["pfp", "ava"];
|
||||
static arguments = ["{mention/id}"];
|
||||
static flags = [{
|
||||
name: "member",
|
||||
type: 6,
|
||||
description: "The member to get the avatar from",
|
||||
required: false
|
||||
}];
|
||||
}
|
||||
|
||||
export default AvatarCommand;
|
|
@ -1,55 +0,0 @@
|
|||
import Command from "../../classes/command.js";
|
||||
import { Routes } from "oceanic.js";
|
||||
const mentionRegex = /^<?[@#]?[&!]?(\d+)>?$/;
|
||||
|
||||
class BannerCommand extends Command {
|
||||
// this command sucks
|
||||
async run() {
|
||||
const member = this.options.member ?? this.args[0];
|
||||
const self = await this.client.rest.users.get(this.author); // banners are only available over REST
|
||||
if (this.type === "classic" && this.message.mentions.users[0] && this.message.mentions.users[0].banner) {
|
||||
return this.client.util.formatImage(Routes.BANNER(this.message.mentions.users[0].id, this.message.mentions.users[0].banner), null, 512);
|
||||
} else if (member && member > 21154535154122752n) {
|
||||
const user = await this.client.rest.users.get(member);
|
||||
if (user && user.banner) {
|
||||
return this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512);
|
||||
} else if (mentionRegex.test(member)) {
|
||||
const id = member.match(mentionRegex)[1];
|
||||
if (id < 21154535154122752n) {
|
||||
this.success = false;
|
||||
return "That's not a valid mention!";
|
||||
}
|
||||
try {
|
||||
const user = await this.client.rest.users.get(id);
|
||||
return user.banner ? this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512) : "This user doesn't have a banner!";
|
||||
} catch {
|
||||
return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "You don't have a banner!";
|
||||
}
|
||||
} else {
|
||||
return "This user doesn't have a banner!";
|
||||
}
|
||||
} else if (this.args.join(" ") !== "" && this.guild) {
|
||||
const searched = await this.guild.searchMembers({
|
||||
query: this.args.join(" "),
|
||||
limit: 1
|
||||
});
|
||||
if (searched.length === 0) return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "This user doesn't have a banner!";
|
||||
const user = await this.client.rest.users.get(searched[0].user.id);
|
||||
return user.banner ? this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512) : (self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "This user doesn't have a banner!");
|
||||
} else {
|
||||
return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "You don't have a banner!";
|
||||
}
|
||||
}
|
||||
|
||||
static description = "Gets a user's banner";
|
||||
static aliases = ["userbanner"];
|
||||
static arguments = ["{mention/id}"];
|
||||
static flags = [{
|
||||
name: "member",
|
||||
type: 6,
|
||||
description: "The member to get the banner from",
|
||||
required: false
|
||||
}];
|
||||
}
|
||||
|
||||
export default BannerCommand;
|
|
@ -3,7 +3,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class DonateCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
let prefix = "";
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => {
|
||||
|
|
|
@ -8,7 +8,7 @@ class EvalCommand extends Command {
|
|||
this.success = false;
|
||||
return "Only the bot owner can use eval!";
|
||||
}
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const code = this.options.code ?? this.args.join(" ");
|
||||
try {
|
||||
let evaled = eval(code);
|
||||
|
|
|
@ -11,7 +11,7 @@ class ExecCommand extends Command {
|
|||
this.success = false;
|
||||
return "Only the bot owner can use exec!";
|
||||
}
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const code = this.options.cmd ?? this.args.join(" ");
|
||||
try {
|
||||
const execed = await exec(code);
|
||||
|
|
|
@ -11,7 +11,7 @@ class ImageSearchCommand extends Command {
|
|||
if (this.channel && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
|
||||
const query = this.options.query ?? this.args.join(" ");
|
||||
if (!query || !query.trim()) return "You need to provide something to search for!";
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const embeds = [];
|
||||
const rawImages = await request(`${random(searx)}/search?format=json&safesearch=2&categories=images&q=!goi%20!ddi%20${encodeURIComponent(query)}`).then(res => res.body.json());
|
||||
if (rawImages.results.length === 0) return "I couldn't find any results!";
|
||||
|
|
|
@ -8,7 +8,7 @@ class ImageReloadCommand extends Command {
|
|||
this.success = false;
|
||||
return "Only the bot owner can reload the image servers!";
|
||||
}
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const length = await reloadImageConnections();
|
||||
if (!length) {
|
||||
if (process.env.PM2_USAGE) {
|
||||
|
|
|
@ -3,28 +3,15 @@ import { connections } from "../../utils/image.js";
|
|||
|
||||
class ImageStatsCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
const embed = {
|
||||
embeds: [{
|
||||
"author": {
|
||||
"name": "esmBot Image Statistics",
|
||||
"iconURL": this.client.user.avatarURL()
|
||||
},
|
||||
"color": 16711680,
|
||||
"description": `The bot is currently connected to ${connections.size} image server(s).`,
|
||||
"fields": []
|
||||
}]
|
||||
};
|
||||
// await this.acknowledge();
|
||||
let desc = `The bot is currently connected to ${connections.size} image server(s).\n`
|
||||
let i = 0;
|
||||
for (const connection of connections.values()) {
|
||||
const count = await connection.getCount();
|
||||
if (!count) continue;
|
||||
embed.embeds[0].fields.push({
|
||||
name: `Server ${i++}`,
|
||||
value: `Running Jobs: ${count}`
|
||||
});
|
||||
desc = desc + `Server ${i++}\nRunning Jobs: ${count}`
|
||||
}
|
||||
return embed;
|
||||
return desc;
|
||||
}
|
||||
|
||||
static description = "Gets some statistics about the image servers";
|
||||
|
|
|
@ -8,7 +8,7 @@ class InfoCommand extends Command {
|
|||
let owner = this.client.users.get(process.env.OWNER.split(",")[0]);
|
||||
if (!owner) owner = await this.client.rest.users.get(process.env.OWNER.split(",")[0]);
|
||||
const servers = await getServers(this.client);
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
return {
|
||||
embeds: [{
|
||||
color: 16711680,
|
||||
|
|
|
@ -4,7 +4,7 @@ import Command from "../../classes/command.js";
|
|||
|
||||
class LengthenCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const input = this.options.url ?? this.args.join(" ");
|
||||
this.success = false;
|
||||
if (!input || !input.trim() || !urlCheck(input)) return "You need to provide a short URL to lengthen!";
|
||||
|
|
|
@ -8,7 +8,7 @@ class QrCreateCommand extends Command {
|
|||
this.success = false;
|
||||
return "You need to provide some text to generate a QR code!";
|
||||
}
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const writable = new PassThrough();
|
||||
qrcode.toFileStream(writable, this.content, { margin: 1 });
|
||||
const file = await this.streamToBuf(writable);
|
||||
|
|
|
@ -10,7 +10,7 @@ class QrReadCommand extends Command {
|
|||
const image = await imageDetect(this.client, this.message, this.interaction, this.options);
|
||||
this.success = false;
|
||||
if (image === undefined) return "You need to provide an image/GIF with a QR code to read!";
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const data = Buffer.from(await (await request(image.path)).body.arrayBuffer());
|
||||
const rawData = await sharp(data).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
||||
const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height);
|
||||
|
|
|
@ -3,7 +3,7 @@ import imageDetect from "../../utils/imagedetect.js";
|
|||
|
||||
class RawCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const image = await imageDetect(this.client, this.message, this.interaction, this.options);
|
||||
if (image === undefined) {
|
||||
this.success = false;
|
||||
|
|
|
@ -8,7 +8,7 @@ class ReloadCommand extends Command {
|
|||
if (!owners.includes(this.author)) return "Only the bot owner can reload commands!";
|
||||
const commandName = this.options.cmd ?? this.args.join(" ");
|
||||
if (!commandName || !commandName.trim()) return "You need to provide a command to reload!";
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const path = paths.get(commandName);
|
||||
if (!path) return "I couldn't find that command!";
|
||||
const result = await load(this.client, path, true);
|
||||
|
|
|
@ -8,7 +8,7 @@ class SoundReloadCommand extends Command {
|
|||
this.success = false;
|
||||
return "Only the bot owner can reload Lavalink!";
|
||||
}
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const length = await reload();
|
||||
if (process.env.PM2_USAGE) {
|
||||
process.send({
|
||||
|
|
|
@ -10,7 +10,7 @@ class YouTubeCommand extends Command {
|
|||
const query = this.options.query ?? this.args.join(" ");
|
||||
this.success = false;
|
||||
if (!query || !query.trim()) return "You need to provide something to search for!";
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const messages = [];
|
||||
const videos = await request(`${random(searx)}/search?format=json&safesearch=1&categories=videos&q=!youtube%20${encodeURIComponent(query)}`).then(res => res.body.json());
|
||||
if (videos.results.length === 0) return "I couldn't find any results!";
|
||||
|
|
|
@ -4,7 +4,7 @@ import { selectedImages } from "../../utils/collections.js";
|
|||
|
||||
class SelectImageCommand extends Command {
|
||||
async run() {
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
const message = this.interaction.data.target;
|
||||
const image = await imageDetect(this.client, message, this.interaction, this.options, true, false, false, true);
|
||||
this.success = false;
|
||||
|
|
|
@ -6,7 +6,7 @@ class MusicAIOCommand extends Command {
|
|||
async run() {
|
||||
let cmd = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
|
||||
if (cmd === "music" || this.constructor.aliases.includes(cmd)) return "https://esmbot.net/robotdance.gif";
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
if (this.type === "classic") {
|
||||
this.origOptions.args.shift();
|
||||
} else {
|
||||
|
|
|
@ -11,7 +11,7 @@ class SoundboardAIOCommand extends Command {
|
|||
return "You need to provide a sound to play!";
|
||||
}
|
||||
const name = sounds.get(soundName);
|
||||
await this.acknowledge();
|
||||
// await this.acknowledge();
|
||||
return await play(this.client, name, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue