Fixes for thread channels, voice commands, image handling, and snowflake, update packages

This commit is contained in:
Essem 2022-09-27 14:46:07 -05:00
parent 238f44967b
commit c70f86607f
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C
18 changed files with 130 additions and 119 deletions

View File

@ -5,8 +5,10 @@ class SnowflakeCommand extends Command {
this.success = false;
if (!this.args[0]) return "You need to provide a snowflake ID!";
if (!this.args[0].match(/^<?[@#]?[&!]?\d+>?$/) && this.args[0] < 21154535154122752n) return "That's not a valid snowflake!";
const id = Math.floor(((this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000) / 1000);
if (isNaN(id)) return "That's not a valid snowflake!";
this.success = true;
return `<t:${Math.floor(((this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000) / 1000)}:F>`;
return `<t:${id}:F>`;
}
static description = "Converts a Discord snowflake id into a timestamp";

View File

@ -5,14 +5,14 @@ class HostCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can choose another host!";
const input = this.options.user ?? this.args.join(" ");
if (input?.trim()) {
let user;
if (this.type === "classic") {
const getUser = this.message.mentions.length >= 1 ? this.message.mentions[0] : this.client.users.get(input);
const getUser = this.message.mentions.users.length >= 1 ? this.message.mentions.users[0] : this.client.users.get(input);
if (getUser) {
user = getUser;
} else if (input.match(/^<?[@#]?[&!]?\d+>?$/) && input >= 21154535154122752n) {

View File

@ -5,8 +5,8 @@ class LoopCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can loop the music!";
const object = this.connection;
object.loop = !object.loop;

View File

@ -5,8 +5,8 @@ class NowPlayingCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
const player = this.connection.player;
if (!player) return "I'm not playing anything!";
const track = await player.node.rest.decode(player.track);

View File

@ -8,8 +8,8 @@ class QueueCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
const player = this.connection;
const node = nodes.filter((val) => val.name === player.player.node.name)[0];

View File

@ -5,8 +5,8 @@ class RemoveCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can remove songs from the queue!";
const pos = parseInt(this.options.position ?? this.args[0]);
if (isNaN(pos) || pos > this.queue.length || pos < 1) return "That's not a valid position!";

View File

@ -4,8 +4,8 @@ class SeekCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (this.connection.host !== this.author.id) return "Only the current voice session host can seek the music!";
const player = this.connection.player;
const track = await player.node.rest.decode(player.track);

View File

@ -5,8 +5,8 @@ class ShuffleCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (this.connection.host !== this.author.id) return "Only the current voice session host can shuffle the music!";
const object = this.connection;
object.shuffle = !object.shuffle;

View File

@ -5,8 +5,8 @@ class SkipCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
const player = this.connection;
if (player.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) {
const votes = skipVotes.get(this.guild.id) ?? { count: 0, ids: [], max: Math.min(3, player.voiceChannel.voiceMembers.filter((i) => i.id !== this.client.user.id && !i.bot).length) };

View File

@ -5,8 +5,8 @@ class StopCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (!this.connection) {
await manager.getNode().leaveChannel(this.guild.id);
this.success = true;

View File

@ -4,8 +4,8 @@ class ToggleCommand extends MusicCommand {
async run() {
this.success = false;
if (!this.guild) return "This command only works in servers!";
if (!this.member.voiceState.channelID) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState.channelID) return "I'm not in a voice channel!";
if (!this.member.voiceState) return "You need to be in a voice channel first!";
if (!this.guild.members.get(this.client.user.id).voiceState) return "I'm not in a voice channel!";
if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can pause/resume the music!";
const player = this.connection.player;
player.setPaused(!player.paused ? true : false);

View File

@ -11,6 +11,7 @@ class SoundboardAIOCommand extends Command {
return "You need to provide a sound to play!";
}
const name = sounds.get(soundName);
await this.acknowledge();
return await play(this.client, name, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction });
}

View File

@ -4,6 +4,7 @@ import { prefixCache, aliases, disabledCache, disabledCmdCache, commands } from
import parseCommand from "../utils/parseCommand.js";
import { clean, cleanMessage } from "../utils/misc.js";
import { upload } from "../utils/tempimages.js";
import { ThreadChannel } from "oceanic.js";
// run when someone sends a message
export default async (client, message) => {
@ -11,7 +12,15 @@ export default async (client, message) => {
if (message.author.bot) return;
// don't run command if bot can't send messages
if (message.guildID && !message.channel.permissionsOf(client.user.id.toString()).has("SEND_MESSAGES")) return;
let permChannel = message.channel;
if (permChannel instanceof ThreadChannel && !permChannel.parent) {
try {
permChannel = await client.rest.channels.get(message.channel.parentID);
} catch {
return;
}
}
if (message.guildID && !permChannel.permissionsOf(client.user.id.toString()).has("SEND_MESSAGES")) return;
let prefixCandidate;
let guildDB;

View File

@ -36,7 +36,7 @@
"jsqr": "^1.4.0",
"node-addon-api": "^5.0.0",
"node-emoji": "^1.11.0",
"oceanic.js": "1.1.1-dev.51a0d21",
"oceanic.js": "1.1.1",
"qrcode": "^1.5.1",
"sharp": "^0.30.7",
"shoukaku": "github:Deivu/shoukaku",
@ -45,11 +45,11 @@
"winston-daily-rotate-file": "^4.7.1"
},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/core": "^7.19.3",
"@babel/eslint-parser": "^7.19.1",
"@babel/eslint-plugin": "^7.19.1",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"eslint": "^8.23.1",
"eslint": "^8.24.0",
"eslint-plugin-unicorn": "^42.0.0"
},
"optionalDependencies": {

View File

@ -1,7 +1,7 @@
lockfileVersion: 5.4
specifiers:
'@babel/core': ^7.19.1
'@babel/core': ^7.19.3
'@babel/eslint-parser': ^7.19.1
'@babel/eslint-plugin': ^7.19.1
'@babel/plugin-proposal-class-properties': ^7.18.6
@ -12,14 +12,14 @@ specifiers:
dotenv: ^16.0.2
emoji-regex: ^10.1.0
erlpack: github:abalabahaha/erlpack
eslint: ^8.23.1
eslint: ^8.24.0
eslint-plugin-unicorn: ^42.0.0
file-type: ^17.1.6
format-duration: ^2.0.0
jsqr: ^1.4.0
node-addon-api: ^5.0.0
node-emoji: ^1.11.0
oceanic.js: 1.1.1-dev.51a0d21
oceanic.js: 1.1.1
pm2: ^5.2.0
postgres: ^3.2.4
qrcode: ^1.5.1
@ -42,7 +42,7 @@ dependencies:
jsqr: 1.4.0
node-addon-api: 5.0.0
node-emoji: 1.11.0
oceanic.js: 1.1.1-dev.51a0d21_bufferutil@4.0.6
oceanic.js: 1.1.1_bufferutil@4.0.6
qrcode: 1.5.1
sharp: 0.30.7
shoukaku: github.com/Deivu/shoukaku/7822080092a13ea4cc71ab7d9f891f5cb933683b_bufferutil@4.0.6
@ -61,12 +61,12 @@ optionalDependencies:
zlib-sync: 0.1.7
devDependencies:
'@babel/core': 7.19.1
'@babel/eslint-parser': 7.19.1_zdglor7vg7osicr5spasq6cc5a
'@babel/eslint-plugin': 7.19.1_64ks3oho3y6ldxyvuvb3gc4oge
'@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.19.1
eslint: 8.23.1
eslint-plugin-unicorn: 42.0.0_eslint@8.23.1
'@babel/core': 7.19.3
'@babel/eslint-parser': 7.19.1_ogeofmzlraie6c2b5yqacorv6u
'@babel/eslint-plugin': 7.19.1_4ytg5tivazyxtttp3wu3kg5tgy
'@babel/plugin-proposal-class-properties': 7.18.6_@babel+core@7.19.3
eslint: 8.24.0
eslint-plugin-unicorn: 42.0.0_eslint@8.24.0
packages:
@ -85,25 +85,25 @@ packages:
'@babel/highlight': 7.18.6
dev: true
/@babel/compat-data/7.19.1:
resolution: {integrity: sha512-72a9ghR0gnESIa7jBN53U32FOVCEoztyIlKaNoU05zRhEecduGK9L9c3ww7Mp06JiR+0ls0GBPFJQwwtjn9ksg==}
/@babel/compat-data/7.19.3:
resolution: {integrity: sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/core/7.19.1:
resolution: {integrity: sha512-1H8VgqXme4UXCRv7/Wa1bq7RVymKOzC7znjyFM8KiEzwFqcKUKYNoQef4GhdklgNvoBXyW4gYhuBNCM5o1zImw==}
/@babel/core/7.19.3:
resolution: {integrity: sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@ampproject/remapping': 2.2.0
'@babel/code-frame': 7.18.6
'@babel/generator': 7.19.0
'@babel/helper-compilation-targets': 7.19.1_@babel+core@7.19.1
'@babel/generator': 7.19.3
'@babel/helper-compilation-targets': 7.19.3_@babel+core@7.19.3
'@babel/helper-module-transforms': 7.19.0
'@babel/helpers': 7.19.0
'@babel/parser': 7.19.1
'@babel/parser': 7.19.3
'@babel/template': 7.18.10
'@babel/traverse': 7.19.1
'@babel/types': 7.19.0
'@babel/traverse': 7.19.3
'@babel/types': 7.19.3
convert-source-map: 1.8.0
debug: 4.3.4
gensync: 1.0.0-beta.2
@ -113,37 +113,37 @@ packages:
- supports-color
dev: true
/@babel/eslint-parser/7.19.1_zdglor7vg7osicr5spasq6cc5a:
/@babel/eslint-parser/7.19.1_ogeofmzlraie6c2b5yqacorv6u:
resolution: {integrity: sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ==}
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
peerDependencies:
'@babel/core': '>=7.11.0'
eslint: ^7.5.0 || ^8.0.0
dependencies:
'@babel/core': 7.19.1
'@babel/core': 7.19.3
'@nicolo-ribaudo/eslint-scope-5-internals': 5.1.1-v1
eslint: 8.23.1
eslint: 8.24.0
eslint-visitor-keys: 2.1.0
semver: 6.3.0
dev: true
/@babel/eslint-plugin/7.19.1_64ks3oho3y6ldxyvuvb3gc4oge:
/@babel/eslint-plugin/7.19.1_4ytg5tivazyxtttp3wu3kg5tgy:
resolution: {integrity: sha512-ElGPkQPapKMa3zVqXHkZYzuL7I5LbRw9UWBUArgWsdWDDb9XcACqOpBib5tRPA9XvbVZYrFUkoQPbiJ4BFvu4w==}
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
peerDependencies:
'@babel/eslint-parser': '>=7.11.0'
eslint: '>=7.5.0'
dependencies:
'@babel/eslint-parser': 7.19.1_zdglor7vg7osicr5spasq6cc5a
eslint: 8.23.1
'@babel/eslint-parser': 7.19.1_ogeofmzlraie6c2b5yqacorv6u
eslint: 8.24.0
eslint-rule-composer: 0.3.0
dev: true
/@babel/generator/7.19.0:
resolution: {integrity: sha512-S1ahxf1gZ2dpoiFgA+ohK9DIpz50bJ0CWs7Zlzb54Z4sG8qmdIrGrVqmy1sAtTVRb+9CU6U8VqT9L0Zj7hxHVg==}
/@babel/generator/7.19.3:
resolution: {integrity: sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
'@jridgewell/gen-mapping': 0.3.2
jsesc: 2.5.2
dev: true
@ -152,29 +152,29 @@ packages:
resolution: {integrity: sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-compilation-targets/7.19.1_@babel+core@7.19.1:
resolution: {integrity: sha512-LlLkkqhCMyz2lkQPvJNdIYU7O5YjWRgC2R4omjCTpZd8u8KMQzZvX4qce+/BluN1rcQiV7BoGUpmQ0LeHerbhg==}
/@babel/helper-compilation-targets/7.19.3_@babel+core@7.19.3:
resolution: {integrity: sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/compat-data': 7.19.1
'@babel/core': 7.19.1
'@babel/compat-data': 7.19.3
'@babel/core': 7.19.3
'@babel/helper-validator-option': 7.18.6
browserslist: 4.21.4
semver: 6.3.0
dev: true
/@babel/helper-create-class-features-plugin/7.19.0_@babel+core@7.19.1:
/@babel/helper-create-class-features-plugin/7.19.0_@babel+core@7.19.3:
resolution: {integrity: sha512-NRz8DwF4jT3UfrmUoZjd0Uph9HQnP30t7Ash+weACcyNkiYTywpIjDBgReJMKgr+n86sn2nPVVmJ28Dm053Kqw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.19.1
'@babel/core': 7.19.3
'@babel/helper-annotate-as-pure': 7.18.6
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.19.0
@ -196,28 +196,28 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.10
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-hoist-variables/7.18.6:
resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-member-expression-to-functions/7.18.9:
resolution: {integrity: sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-module-imports/7.18.6:
resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-module-transforms/7.19.0:
@ -230,8 +230,8 @@ packages:
'@babel/helper-split-export-declaration': 7.18.6
'@babel/helper-validator-identifier': 7.19.1
'@babel/template': 7.18.10
'@babel/traverse': 7.19.1
'@babel/types': 7.19.0
'@babel/traverse': 7.19.3
'@babel/types': 7.19.3
transitivePeerDependencies:
- supports-color
dev: true
@ -240,7 +240,7 @@ packages:
resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-plugin-utils/7.19.0:
@ -255,8 +255,8 @@ packages:
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-member-expression-to-functions': 7.18.9
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/traverse': 7.19.1
'@babel/types': 7.19.0
'@babel/traverse': 7.19.3
'@babel/types': 7.19.3
transitivePeerDependencies:
- supports-color
dev: true
@ -265,14 +265,14 @@ packages:
resolution: {integrity: sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-split-export-declaration/7.18.6:
resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/helper-string-parser/7.18.10:
@ -295,8 +295,8 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.10
'@babel/traverse': 7.19.1
'@babel/types': 7.19.0
'@babel/traverse': 7.19.3
'@babel/types': 7.19.3
transitivePeerDependencies:
- supports-color
dev: true
@ -310,22 +310,22 @@ packages:
js-tokens: 4.0.0
dev: true
/@babel/parser/7.19.1:
resolution: {integrity: sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==}
/@babel/parser/7.19.3:
resolution: {integrity: sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.19.0
'@babel/types': 7.19.3
dev: true
/@babel/plugin-proposal-class-properties/7.18.6_@babel+core@7.19.1:
/@babel/plugin-proposal-class-properties/7.18.6_@babel+core@7.19.3:
resolution: {integrity: sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.19.1
'@babel/helper-create-class-features-plugin': 7.19.0_@babel+core@7.19.1
'@babel/core': 7.19.3
'@babel/helper-create-class-features-plugin': 7.19.0_@babel+core@7.19.3
'@babel/helper-plugin-utils': 7.19.0
transitivePeerDependencies:
- supports-color
@ -336,30 +336,30 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/parser': 7.19.1
'@babel/types': 7.19.0
'@babel/parser': 7.19.3
'@babel/types': 7.19.3
dev: true
/@babel/traverse/7.19.1:
resolution: {integrity: sha512-0j/ZfZMxKukDaag2PtOPDbwuELqIar6lLskVPPJDjXMXjfLb1Obo/1yjxIGqqAJrmfaTIY3z2wFLAQ7qSkLsuA==}
/@babel/traverse/7.19.3:
resolution: {integrity: sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/generator': 7.19.0
'@babel/generator': 7.19.3
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.19.0
'@babel/helper-hoist-variables': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/parser': 7.19.1
'@babel/types': 7.19.0
'@babel/parser': 7.19.3
'@babel/types': 7.19.3
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/types/7.19.0:
resolution: {integrity: sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==}
/@babel/types/7.19.3:
resolution: {integrity: sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-string-parser': 7.18.10
@ -625,8 +625,8 @@ packages:
- encoding
dev: false
/@types/node/18.7.19:
resolution: {integrity: sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA==}
/@types/node/18.7.23:
resolution: {integrity: sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==}
dev: false
optional: true
@ -637,7 +637,7 @@ packages:
/@types/ws/8.5.3:
resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==}
dependencies:
'@types/node': 18.7.19
'@types/node': 18.7.23
dev: false
optional: true
@ -877,8 +877,8 @@ packages:
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001410
electron-to-chromium: 1.4.259
caniuse-lite: 1.0.30001412
electron-to-chromium: 1.4.264
node-releases: 2.0.6
update-browserslist-db: 1.0.9_browserslist@4.21.4
dev: true
@ -942,8 +942,8 @@ packages:
engines: {node: '>=6'}
dev: false
/caniuse-lite/1.0.30001410:
resolution: {integrity: sha512-QoblBnuE+rG0lc3Ur9ltP5q47lbguipa/ncNMyyGuqPk44FxbScWAeEO+k5fSQ8WekdAK4mWqNs1rADDAiN5xQ==}
/caniuse-lite/1.0.30001412:
resolution: {integrity: sha512-+TeEIee1gS5bYOiuf+PS/kp2mrXic37Hl66VY6EAfxasIk5fELTktK2oOezYed12H8w7jt3s512PpulQidPjwA==}
dev: true
/chainsaw/0.1.0:
@ -1272,8 +1272,8 @@ packages:
readable-stream: 2.1.5
dev: false
/electron-to-chromium/1.4.259:
resolution: {integrity: sha512-dzbPZG0PKsqiSxfZovjBZn5InX4OoSITSsJ5S/U0QRrFaKsQtHx352zbyqtiDpNpX5lnPCAeBS6D+QpWipqDRw==}
/electron-to-chromium/1.4.264:
resolution: {integrity: sha512-AZ6ZRkucHOQT8wke50MktxtmcWZr67kE17X/nAXFf62NIdMdgY6xfsaJD5Szoy84lnkuPWH+4tTNE3s2+bPCiw==}
dev: true
/emitter-listener/1.1.2:
@ -1347,7 +1347,7 @@ packages:
dev: false
optional: true
/eslint-plugin-unicorn/42.0.0_eslint@8.23.1:
/eslint-plugin-unicorn/42.0.0_eslint@8.24.0:
resolution: {integrity: sha512-ixBsbhgWuxVaNlPTT8AyfJMlhyC5flCJFjyK3oKE8TRrwBnaHvUbuIkCM1lqg8ryYrFStL/T557zfKzX4GKSlg==}
engines: {node: '>=12'}
peerDependencies:
@ -1356,8 +1356,8 @@ packages:
'@babel/helper-validator-identifier': 7.19.1
ci-info: 3.4.0
clean-regexp: 1.0.0
eslint: 8.23.1
eslint-utils: 3.0.0_eslint@8.23.1
eslint: 8.24.0
eslint-utils: 3.0.0_eslint@8.24.0
esquery: 1.4.0
indent-string: 4.0.0
is-builtin-module: 3.2.0
@ -1391,13 +1391,13 @@ packages:
estraverse: 5.3.0
dev: true
/eslint-utils/3.0.0_eslint@8.23.1:
/eslint-utils/3.0.0_eslint@8.24.0:
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
peerDependencies:
eslint: '>=5'
dependencies:
eslint: 8.23.1
eslint: 8.24.0
eslint-visitor-keys: 2.1.0
dev: true
@ -1411,8 +1411,8 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true
/eslint/8.23.1:
resolution: {integrity: sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==}
/eslint/8.24.0:
resolution: {integrity: sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true
dependencies:
@ -1427,7 +1427,7 @@ packages:
doctrine: 3.0.0
escape-string-regexp: 4.0.0
eslint-scope: 7.1.1
eslint-utils: 3.0.0_eslint@8.23.1
eslint-utils: 3.0.0_eslint@8.24.0
eslint-visitor-keys: 3.3.0
espree: 9.4.0
esquery: 1.4.0
@ -2304,8 +2304,8 @@ packages:
dev: false
optional: true
/node-abi/3.24.0:
resolution: {integrity: sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw==}
/node-abi/3.25.0:
resolution: {integrity: sha512-p+0xx5ruIQ+8X57CRIMxbTZRT7tU0Tjn2C/aAK68AEMrbGsCo6IjnDdPNhEyyjWCT4bRtzomXchYd3sSgk3BJQ==}
engines: {node: '>=10'}
dependencies:
semver: 7.3.7
@ -2384,8 +2384,8 @@ packages:
engines: {node: '>= 6'}
dev: false
/oceanic.js/1.1.1-dev.51a0d21_bufferutil@4.0.6:
resolution: {integrity: sha512-Ks/SuYCY9inHSU0iHAWBUwy73den1T4DDs8HbyYMXDE36o3RYjQx5w54u5gZ5pjoEBg7/Ik1hQbJmfC0kH8F9g==}
/oceanic.js/1.1.1_bufferutil@4.0.6:
resolution: {integrity: sha512-BbV/NHdiSzXjJfvJgqdBPQVqu71YSsYT60dPJmflnC1aLX6L8bhV60DFZgp9oUJNB4wazD5+bEiB0f8u0YWiPA==}
engines: {node: '>=16.16.0'}
dependencies:
undici: 5.10.0
@ -2698,7 +2698,7 @@ packages:
minimist: 1.2.6
mkdirp-classic: 0.5.3
napi-build-utils: 1.0.2
node-abi: 3.24.0
node-abi: 3.25.0
pump: 3.0.0
rc: 1.2.8
simple-get: 4.0.1

View File

@ -121,13 +121,13 @@ const checkImages = async (message, extraReturnTypes, video, sticker) => {
type = await getImage(message.embeds[0].video.url, message.embeds[0].url, video, extraReturnTypes, true);
// then we check for other image types
} else if ((message.embeds[0].type === "video" || message.embeds[0].type === "image") && message.embeds[0].thumbnail) {
type = await getImage(message.embeds[0].thumbnail.proxy_url, message.embeds[0].thumbnail.url, video, extraReturnTypes);
type = await getImage(message.embeds[0].thumbnail.proxyURL, message.embeds[0].thumbnail.url, video, extraReturnTypes);
// finally we check both possible image fields for "generic" embeds
} else if (message.embeds[0].type === "rich" || message.embeds[0].type === "article") {
if (message.embeds[0].thumbnail) {
type = await getImage(message.embeds[0].thumbnail.proxy_url, message.embeds[0].thumbnail.url, video, extraReturnTypes);
type = await getImage(message.embeds[0].thumbnail.proxyURL, message.embeds[0].thumbnail.url, video, extraReturnTypes);
} else if (message.embeds[0].image) {
type = await getImage(message.embeds[0].image.proxy_url, message.embeds[0].image.url, video, extraReturnTypes);
type = await getImage(message.embeds[0].image.proxyURL, message.embeds[0].image.url, video, extraReturnTypes);
}
}
// then check the attachments
@ -158,7 +158,7 @@ export default async (client, cmdMessage, interaction, options, extraReturnTypes
if (cmdMessage) {
// check if the message is a reply to another message
if (cmdMessage.messageReference) {
const replyMessage = await client.getMessage(cmdMessage.messageReference.channelID, cmdMessage.messageReference.messageID).catch(() => undefined);
const replyMessage = await client.rest.channels.getMessage(cmdMessage.messageReference.channelID, cmdMessage.messageReference.messageID).catch(() => undefined);
if (replyMessage) {
const replyResult = await checkImages(replyMessage, extraReturnTypes, video, sticker);
if (replyResult !== false) return replyResult;

View File

@ -33,7 +33,6 @@ export async function checkStatus() {
export function connect(client) {
manager = new Shoukaku(new Connectors.OceanicJS(client), nodes, { moveOnDisconnect: true, resume: true, reconnectInterval: 500, reconnectTries: 1 });
client.emit("ready"); // workaround
manager.on("error", (node, error) => {
logger.error(`An error occurred on Lavalink node ${node}: ${error}`);
});

View File

@ -23,11 +23,11 @@ export async function upload(client, result, context, interaction = false) {
if (interaction) {
await context[context.acknowledged ? "editOriginal" : "createMessage"](payload);
} else {
await client.rest.channels.createMessage(context.channel.id, Object.assign(payload, {
await client.rest.channels.createMessage(context.channelID, Object.assign(payload, {
messageReference: {
channelID: context.channel.id,
channelID: context.channelID,
messageID: context.id,
guildID: context.channel.guildID ?? undefined,
guildID: context.guildID ?? undefined,
failIfNotExists: false
},
allowedMentions: {