Initial Oceanic port (still unfinished), update packages, remove serverinfo and userinfo
This commit is contained in:
parent
bf90ae108a
commit
888f2f8b4a
49 changed files with 573 additions and 515 deletions
|
@ -8,15 +8,16 @@ class Command {
|
|||
if (options.type === "classic") {
|
||||
this.message = options.message;
|
||||
this.channel = options.message.channel;
|
||||
this.guild = options.message.guild;
|
||||
this.author = options.message.author;
|
||||
this.member = options.message.member;
|
||||
this.content = options.content;
|
||||
this.options = options.specialArgs;
|
||||
this.reference = {
|
||||
messageReference: {
|
||||
channelID: this.channel.id,
|
||||
channelID: this.message.channelID,
|
||||
messageID: this.message.id,
|
||||
guildID: this.channel.guild ? this.channel.guild.id : undefined,
|
||||
guildID: this.message.guildID ?? undefined,
|
||||
failIfNotExists: false
|
||||
},
|
||||
allowedMentions: {
|
||||
|
@ -27,13 +28,14 @@ class Command {
|
|||
this.interaction = options.interaction;
|
||||
this.args = [];
|
||||
this.channel = options.interaction.channel;
|
||||
this.guild = options.interaction.guild;
|
||||
this.author = this.member = options.interaction.guildID ? options.interaction.member : options.interaction.user;
|
||||
if (options.interaction.data.options) {
|
||||
this.options = options.interaction.data.options.reduce((obj, item) => {
|
||||
this.options = options.interaction.data.options.raw.reduce((obj, item) => {
|
||||
obj[item.name] = item.value;
|
||||
return obj;
|
||||
}, {});
|
||||
this.optionsArray = options.interaction.data.options;
|
||||
this.optionsArray = options.interaction.data.options.raw;
|
||||
} else {
|
||||
this.options = {};
|
||||
}
|
||||
|
@ -46,9 +48,10 @@ class Command {
|
|||
|
||||
async acknowledge() {
|
||||
if (this.type === "classic") {
|
||||
await this.client.sendChannelTyping(this.channel.id);
|
||||
const channel = this.channel ?? await this.client.rest.channels.get(this.message.channelID);
|
||||
await channel.sendTyping();
|
||||
} else if (!this.interaction.acknowledged) {
|
||||
await this.interaction.acknowledge();
|
||||
await this.interaction.defer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class ImageCommand extends Command {
|
|||
|
||||
let status;
|
||||
if (imageParams.params.type === "image/gif" && this.type === "classic") {
|
||||
status = await this.processMessage(this.message);
|
||||
status = await this.processMessage(this.message.channel ?? await this.client.rest.channels.get(this.message.channelID));
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -83,7 +83,7 @@ class ImageCommand extends Command {
|
|||
}
|
||||
this.success = true;
|
||||
return {
|
||||
file: buffer,
|
||||
contents: buffer,
|
||||
name: `${this.constructor.command}.${type}`
|
||||
};
|
||||
} catch (e) {
|
||||
|
@ -92,14 +92,17 @@ class ImageCommand extends Command {
|
|||
if (e === "No available servers") return "I can't seem to contact the image servers, they might be down or still trying to start up. Please wait a little bit.";
|
||||
throw e;
|
||||
} finally {
|
||||
if (status && (status.channel.messages ? status.channel.messages.has(status.id) : await this.client.getMessage(status.channel.id, status.id).catch(() => undefined))) await status.delete();
|
||||
const statusChannel = status.channel ?? await this.client.rest.channels.get(status.channelID);
|
||||
if (status && (statusChannel.messages ? statusChannel.messages.has(status.id) : await this.client.getMessage(statusChannel.id, status.id).catch(() => undefined))) await status.delete();
|
||||
runningCommands.delete(this.author.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
processMessage(message) {
|
||||
return this.client.createMessage(message.channel.id, `${random(emotes) || process.env.PROCESSING_EMOJI || "<a:processing:479351417102925854>"} Processing... This might take a while`);
|
||||
processMessage(channel) {
|
||||
return channel.createMessage({
|
||||
content: `${random(emotes) || process.env.PROCESSING_EMOJI || "<a:processing:479351417102925854>"} Processing... This might take a while`
|
||||
});
|
||||
}
|
||||
|
||||
static init() {
|
||||
|
|
|
@ -4,9 +4,9 @@ import { players, queues } from "../utils/soundplayer.js";
|
|||
class MusicCommand extends Command {
|
||||
constructor(client, options) {
|
||||
super(client, options);
|
||||
if (this.channel.guild) {
|
||||
this.connection = players.get(this.channel.guild.id);
|
||||
this.queue = queues.get(this.channel.guild.id);
|
||||
if (this.guild) {
|
||||
this.connection = players.get(this.guild.id);
|
||||
this.queue = queues.get(this.guild.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue