mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
style: format (#2925)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
const UtilCommand = require("./CommandResponse.js");
|
||||
const UtilCommand = require('./CommandResponse.js')
|
||||
class BaseCommand extends UtilCommand {
|
||||
constructor(data) {
|
||||
super(data);
|
||||
this.message = data.message;
|
||||
this.interaction = data.interaction;
|
||||
this.user = this.message ? this.message.author : this.interaction.user;
|
||||
this.guild = this.message ? this.message.guild : this.interaction.guild;
|
||||
this.member = this.message ? this.message.member : this.interaction.member;
|
||||
this.channel = this.message ? this.message.channel : this.interaction.channel;
|
||||
this.client = data.client;
|
||||
this.settings = data.settings ?? {};
|
||||
super(data)
|
||||
this.message = data.message
|
||||
this.interaction = data.interaction
|
||||
this.user = this.message ? this.message.author : this.interaction.user
|
||||
this.guild = this.message ? this.message.guild : this.interaction.guild
|
||||
this.member = this.message ? this.message.member : this.interaction.member
|
||||
this.channel = this.message ? this.message.channel : this.interaction.channel
|
||||
this.client = data.client
|
||||
this.settings = data.settings ?? {}
|
||||
}
|
||||
}
|
||||
module.exports = BaseCommand;
|
||||
module.exports = BaseCommand
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
class Responses {
|
||||
constructor(data) {
|
||||
this.manager = data.manager;
|
||||
this.args = this._validateArguments(data.args);
|
||||
this.replied = false;
|
||||
this.manager = data.manager
|
||||
this.args = this._validateArguments(data.args)
|
||||
this.replied = false
|
||||
}
|
||||
|
||||
async reply(content) {
|
||||
// When just a string is passed, we assume it's the content -> transform to correct formatted payload
|
||||
if (typeof content === "string") content = { content };
|
||||
if (typeof content === 'string') content = { content }
|
||||
if (this.interaction) {
|
||||
if (this.replied) return this.followUp(content);
|
||||
const reply = await this.interaction.reply(content);
|
||||
this.replied = true;
|
||||
return {};
|
||||
if (this.replied) return this.followUp(content)
|
||||
const reply = await this.interaction.reply(content)
|
||||
this.replied = true
|
||||
return {}
|
||||
}
|
||||
if (this.message) {
|
||||
if (this.replied) return this.followUp(content);
|
||||
if (this.replied) return this.followUp(content)
|
||||
|
||||
const msg = await this.message.channel.send(content);
|
||||
const msg = await this.message.channel.send(content)
|
||||
|
||||
// Assign properties to the response
|
||||
const response = this.client.messages.forge(msg);
|
||||
this.replied = true;
|
||||
return response;
|
||||
const response = this.client.messages.forge(msg)
|
||||
this.replied = true
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
async followUp(content) {
|
||||
if (this.interaction) {
|
||||
const reply = await this.interaction.followUp(content);
|
||||
return {};
|
||||
const reply = await this.interaction.followUp(content)
|
||||
return {}
|
||||
}
|
||||
if (this.message) {
|
||||
const msg = await this.message.channel.send(content);
|
||||
const response = this.client.messages.forge(msg);
|
||||
return response;
|
||||
const msg = await this.message.channel.send(content)
|
||||
const response = this.client.messages.forge(msg)
|
||||
return response
|
||||
}
|
||||
}
|
||||
|
||||
onError(error) {
|
||||
return this.reply({ content: `A unknown Error happend: \n> ${error}` });
|
||||
return this.reply({ content: `A unknown Error happend: \n> ${error}` })
|
||||
}
|
||||
|
||||
_validateArguments(args) {
|
||||
this.args = args;
|
||||
return args;
|
||||
this.args = args
|
||||
return args
|
||||
}
|
||||
}
|
||||
module.exports = Responses;
|
||||
module.exports = Responses
|
||||
|
||||
Reference in New Issue
Block a user