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

@ -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: {