mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
style: format (#2925)
This commit is contained in:
@@ -1,51 +1,56 @@
|
||||
const Discord = require("discordeno.js");
|
||||
const Discord = require('discordeno.js')
|
||||
|
||||
const BaseCommand = require("../../../Structures/BaseCommand.js");
|
||||
const BaseCommand = require('../../../Structures/BaseCommand.js')
|
||||
class evalcommand extends BaseCommand {
|
||||
static name = "eval";
|
||||
static description = "danger !!!";
|
||||
static category = "Developer";
|
||||
static slash = { name: "eval", category: "dev" };
|
||||
static name = 'eval'
|
||||
static description = 'danger !!!'
|
||||
static category = 'Developer'
|
||||
static slash = { name: 'eval', category: 'dev' }
|
||||
constructor(data) {
|
||||
super(data);
|
||||
super(data)
|
||||
}
|
||||
|
||||
async execute() {
|
||||
if (!this.client.config.owners.includes(String(this.user.id))) return;
|
||||
if (!(this.args.length > 0)) return this.reply({ content: "**You must provide something to eval!**" });
|
||||
if (!this.client.config.owners.includes(String(this.user.id))) return
|
||||
if (!(this.args.length > 0)) return this.reply({ content: '**You must provide something to eval!**' })
|
||||
|
||||
const inputOfEval = this.args.join(" ");
|
||||
let outputOfEval;
|
||||
let typeOfEval;
|
||||
const inputOfEval = this.args.join(' ')
|
||||
let outputOfEval
|
||||
let typeOfEval
|
||||
|
||||
try {
|
||||
if (this.args.includes("await")) {
|
||||
outputOfEval = await eval("(async () => {" + inputOfEval + "})()");
|
||||
if (this.args.includes('await')) {
|
||||
outputOfEval = await eval('(async () => {' + inputOfEval + '})()')
|
||||
} else {
|
||||
outputOfEval = await eval(inputOfEval);
|
||||
outputOfEval = await eval(inputOfEval)
|
||||
}
|
||||
} catch (e) {
|
||||
outputOfEval = e.message;
|
||||
typeOfEval = e.name;
|
||||
outputOfEval = e.message
|
||||
typeOfEval = e.name
|
||||
}
|
||||
|
||||
const seen = [];
|
||||
outputOfEval = typeof outputOfEval === "object"
|
||||
? JSON.stringify(outputOfEval, (_, value) => {
|
||||
if (value == `Bot ${this.client.config.token}`) return `BOT_TOKEN`;
|
||||
if (typeof value === "bigint") value = value.toString();
|
||||
if (typeof value === "object" && value !== null) {
|
||||
if (seen.indexOf(value) !== -1) return;
|
||||
else seen.push(value);
|
||||
}
|
||||
return value;
|
||||
}, 1)
|
||||
: outputOfEval;
|
||||
const seen = []
|
||||
outputOfEval =
|
||||
typeof outputOfEval === 'object'
|
||||
? JSON.stringify(
|
||||
outputOfEval,
|
||||
(_, value) => {
|
||||
if (value == `Bot ${this.client.config.token}`) return `BOT_TOKEN`
|
||||
if (typeof value === 'bigint') value = value.toString()
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
if (seen.indexOf(value) !== -1) return
|
||||
else seen.push(value)
|
||||
}
|
||||
return value
|
||||
},
|
||||
1,
|
||||
)
|
||||
: outputOfEval
|
||||
|
||||
const embed = new Discord.Embed()
|
||||
.addField({ name: "Input", value: "```js\n" + inputOfEval + "```" })
|
||||
.addField({ name: "Output", value: "```json\n" + `${outputOfEval}`.slice(0, 1000) + "```" });
|
||||
this.reply({ embeds: [embed] });
|
||||
.addField({ name: 'Input', value: '```js\n' + inputOfEval + '```' })
|
||||
.addField({ name: 'Output', value: '```json\n' + `${outputOfEval}`.slice(0, 1000) + '```' })
|
||||
this.reply({ embeds: [embed] })
|
||||
}
|
||||
}
|
||||
module.exports = evalcommand;
|
||||
module.exports = evalcommand
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
const BaseCommand = require("../../../Structures/BaseCommand.js");
|
||||
const BaseCommand = require('../../../Structures/BaseCommand.js')
|
||||
class reloadcommand extends BaseCommand {
|
||||
static name = "reload";
|
||||
static description = "Reloads a Command";
|
||||
static category = "Developer";
|
||||
static slash = { name: "reload", category: "dev" };
|
||||
static name = 'reload'
|
||||
static description = 'Reloads a Command'
|
||||
static category = 'Developer'
|
||||
static slash = { name: 'reload', category: 'dev' }
|
||||
constructor(data) {
|
||||
super(data);
|
||||
super(data)
|
||||
}
|
||||
|
||||
async execute() {
|
||||
if (!this.client.config.owners.includes(String(this.user.id))) return;
|
||||
if (!this.args[0]) return this.reply({ content: "**You must provide a command to reload!**" });
|
||||
const op = this.client.commands.reloadCommand(this.args[0]);
|
||||
if (!op) return this.reply({ content: "**That command doesn't exist!**" });
|
||||
return this.reply({ content: "**Reloaded Command: `" + this.args[0] + "`**" });
|
||||
if (!this.client.config.owners.includes(String(this.user.id))) return
|
||||
if (!this.args[0]) return this.reply({ content: '**You must provide a command to reload!**' })
|
||||
const op = this.client.commands.reloadCommand(this.args[0])
|
||||
if (!op) return this.reply({ content: "**That command doesn't exist!**" })
|
||||
return this.reply({ content: '**Reloaded Command: `' + this.args[0] + '`**' })
|
||||
}
|
||||
}
|
||||
module.exports = reloadcommand;
|
||||
module.exports = reloadcommand
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
const BaseCommand = require("../../../Structures/BaseCommand.js");
|
||||
const Discord = require("discordeno.js");
|
||||
const BaseCommand = require('../../../Structures/BaseCommand.js')
|
||||
const Discord = require('discordeno.js')
|
||||
class pingcommand extends BaseCommand {
|
||||
static name = "ping";
|
||||
static description = "See if the bot latency is okay";
|
||||
static usage = "";
|
||||
static category = "General";
|
||||
static slash = { name: "ping", category: "info" };
|
||||
static name = 'ping'
|
||||
static description = 'See if the bot latency is okay'
|
||||
static usage = ''
|
||||
static category = 'General'
|
||||
static slash = { name: 'ping', category: 'info' }
|
||||
constructor(data) {
|
||||
super(data);
|
||||
super(data)
|
||||
}
|
||||
|
||||
async execute() {
|
||||
const msg = await this.channel.send({ content: `Pinging...` });
|
||||
const msg = await this.channel.send({ content: `Pinging...` })
|
||||
// Assign properties to the response
|
||||
const ping = msg.timestamp - (this.message ? this.message.timestamp : this.interaction.timestamp);
|
||||
const ping = msg.timestamp - (this.message ? this.message.timestamp : this.interaction.timestamp)
|
||||
|
||||
const embed = new Discord.Embed()
|
||||
.setTitle(`The Bots ping is ${ping} ms`)
|
||||
.toJSON();
|
||||
const embed = new Discord.Embed().setTitle(`The Bots ping is ${ping} ms`).toJSON()
|
||||
// Edit Message with the Embed
|
||||
return this.reply({ embeds: [embed] });
|
||||
return this.reply({ embeds: [embed] })
|
||||
}
|
||||
}
|
||||
module.exports = pingcommand;
|
||||
module.exports = pingcommand
|
||||
|
||||
@@ -1,41 +1,47 @@
|
||||
const BaseCommand = require("../../../Structures/BaseCommand.js");
|
||||
const Discord = require("discordeno.js");
|
||||
const BaseCommand = require('../../../Structures/BaseCommand.js')
|
||||
const Discord = require('discordeno.js')
|
||||
|
||||
class bancommand extends BaseCommand {
|
||||
static name = "ban";
|
||||
static description = "Ban a user from the server";
|
||||
static usage = "";
|
||||
static category = "Moderation";
|
||||
static slash = { name: "ban", category: "mod" };
|
||||
static name = 'ban'
|
||||
static description = 'Ban a user from the server'
|
||||
static usage = ''
|
||||
static category = 'Moderation'
|
||||
static slash = { name: 'ban', category: 'mod' }
|
||||
constructor(data) {
|
||||
super(data);
|
||||
super(data)
|
||||
}
|
||||
|
||||
async execute() {
|
||||
// Show Case Modal
|
||||
|
||||
// Because no permission system has not been added
|
||||
if (!this.client.config.owners.includes(String(this.user.id))) return;
|
||||
if (!this.client.config.owners.includes(String(this.user.id))) return
|
||||
|
||||
const textinput = new Discord.Component()
|
||||
.setType("TEXT_INPUT")
|
||||
.setStyle("SHORT")
|
||||
.setCustomId("t1")
|
||||
.setLabel("User ID")
|
||||
.setPlaceholder("User ID")
|
||||
.setType('TEXT_INPUT')
|
||||
.setStyle('SHORT')
|
||||
.setCustomId('t1')
|
||||
.setLabel('User ID')
|
||||
.setPlaceholder('User ID')
|
||||
.setRequired(true)
|
||||
.setMaxLength(20)
|
||||
.setMinLength(1)
|
||||
.setValue(this.args[0])
|
||||
.toJSON();
|
||||
const textinput2 = new Discord.Component().setType("TEXT_INPUT").setStyle("PARAGRAPH").setCustomId("t2")
|
||||
.setLabel("Reason").setPlaceholder("Reason for Ban").setRequired(false)
|
||||
.setMaxLength(300).toJSON();
|
||||
.toJSON()
|
||||
const textinput2 = new Discord.Component()
|
||||
.setType('TEXT_INPUT')
|
||||
.setStyle('PARAGRAPH')
|
||||
.setCustomId('t2')
|
||||
.setLabel('Reason')
|
||||
.setPlaceholder('Reason for Ban')
|
||||
.setRequired(false)
|
||||
.setMaxLength(300)
|
||||
.toJSON()
|
||||
|
||||
const actionrow = new Discord.Component().setType(1).setComponents(textinput).toJSON();
|
||||
const actionrow2 = new Discord.Component().setType(1).setComponents(textinput2).toJSON();
|
||||
const actionrow = new Discord.Component().setType(1).setComponents(textinput).toJSON()
|
||||
const actionrow2 = new Discord.Component().setType(1).setComponents(textinput2).toJSON()
|
||||
|
||||
this.interaction.popupModal({ customId: "ban_modal", title: "Ban User", components: [actionrow, actionrow2] });
|
||||
this.interaction.popupModal({ customId: 'ban_modal', title: 'Ban User', components: [actionrow, actionrow2] })
|
||||
}
|
||||
}
|
||||
module.exports = bancommand;
|
||||
module.exports = bancommand
|
||||
|
||||
@@ -1,82 +1,89 @@
|
||||
const BaseCommand = require("../../../Structures/BaseCommand.js");
|
||||
const BaseCommand = require('../../../Structures/BaseCommand.js')
|
||||
|
||||
const { Interaction, Collector, ComponentOptions, Embed, Component } = require("discordeno.js");
|
||||
const { Interaction, Collector, ComponentOptions, Embed, Component } = require('discordeno.js')
|
||||
|
||||
class warncommand extends BaseCommand {
|
||||
static name = "warn";
|
||||
static description = "Warn a user from the server";
|
||||
static usage = "";
|
||||
static category = "Moderation";
|
||||
static slash = { name: "warn", category: "mod" };
|
||||
static name = 'warn'
|
||||
static description = 'Warn a user from the server'
|
||||
static usage = ''
|
||||
static category = 'Moderation'
|
||||
static slash = { name: 'warn', category: 'mod' }
|
||||
constructor(data) {
|
||||
super(data);
|
||||
super(data)
|
||||
}
|
||||
|
||||
async execute() {
|
||||
// Show Case Modal
|
||||
if (!this.interaction) return this.reply("You currently can just use this command as slash command.");
|
||||
if (!this.interaction) return this.reply('You currently can just use this command as slash command.')
|
||||
|
||||
if (!this.interaction.member.permissions.has("KICK_MEMBERS")) {
|
||||
return this.reply("You need the permission `KICK_MEMBERS` to use this command.");
|
||||
if (!this.interaction.member.permissions.has('KICK_MEMBERS')) {
|
||||
return this.reply('You need the permission `KICK_MEMBERS` to use this command.')
|
||||
}
|
||||
|
||||
const textinput = new Component()
|
||||
.setType("TEXT_INPUT")
|
||||
.setStyle("SHORT")
|
||||
.setCustomId("t1")
|
||||
.setLabel("User ID")
|
||||
.setPlaceholder("User ID")
|
||||
.setType('TEXT_INPUT')
|
||||
.setStyle('SHORT')
|
||||
.setCustomId('t1')
|
||||
.setLabel('User ID')
|
||||
.setPlaceholder('User ID')
|
||||
.setRequired(true)
|
||||
.setMaxLength(20)
|
||||
.setMinLength(1)
|
||||
.setValue(this.args[0])
|
||||
.toJSON();
|
||||
const textinput2 = new Component().setType("TEXT_INPUT").setStyle("PARAGRAPH").setCustomId("t2")
|
||||
.setLabel("Reason").setPlaceholder("Reason for Warning").setRequired(false)
|
||||
.setMaxLength(300).toJSON();
|
||||
.toJSON()
|
||||
const textinput2 = new Component()
|
||||
.setType('TEXT_INPUT')
|
||||
.setStyle('PARAGRAPH')
|
||||
.setCustomId('t2')
|
||||
.setLabel('Reason')
|
||||
.setPlaceholder('Reason for Warning')
|
||||
.setRequired(false)
|
||||
.setMaxLength(300)
|
||||
.toJSON()
|
||||
|
||||
const actionrow = new Component().setType(1).setComponents(textinput).toJSON();
|
||||
const actionrow2 = new Component().setType(1).setComponents(textinput2).toJSON();
|
||||
const actionrow = new Component().setType(1).setComponents(textinput).toJSON()
|
||||
const actionrow2 = new Component().setType(1).setComponents(textinput2).toJSON()
|
||||
|
||||
this.interaction.popupModal({ customId: "warn_modal", title: "Warn User", components: [actionrow, actionrow2] });
|
||||
this.interaction.popupModal({ customId: 'warn_modal', title: 'Warn User', components: [actionrow, actionrow2] })
|
||||
|
||||
const filter = (m) => m.data?.customId === "warn_modal";
|
||||
const collector = new Collector("interactionCreate", { client: this.client, timeout: 60000, filter });
|
||||
collector.on("collect", (m) => {
|
||||
const options = new ComponentOptions(m.data.components);
|
||||
const i = new Interaction(this.client, m);
|
||||
collector.stop();
|
||||
const filter = (m) => m.data?.customId === 'warn_modal'
|
||||
const collector = new Collector('interactionCreate', { client: this.client, timeout: 60000, filter })
|
||||
collector.on('collect', (m) => {
|
||||
const options = new ComponentOptions(m.data.components)
|
||||
const i = new Interaction(this.client, m)
|
||||
collector.stop()
|
||||
|
||||
const memberId = options.get("t1").value;
|
||||
const reason = options.get("t2").value;
|
||||
const memberId = options.get('t1').value
|
||||
const reason = options.get('t2').value
|
||||
|
||||
const embed = new Embed()
|
||||
.setTitle("Warned User:")
|
||||
.setDescription(`User ID: <@${memberId}> \n Reason: ${reason}`)
|
||||
.setColor(0x00ff00)
|
||||
.toJSON();
|
||||
const embed = new Embed().setTitle('Warned User:').setDescription(`User ID: <@${memberId}> \n Reason: ${reason}`).setColor(0x00ff00).toJSON()
|
||||
|
||||
const warnMessage = new Embed()
|
||||
.setTitle("Warning:")
|
||||
.setDescription(`You have been warned in **${this.guild.name}** for ${"`" + reason + "`"}`)
|
||||
.toJSON();
|
||||
.setTitle('Warning:')
|
||||
.setDescription(`You have been warned in **${this.guild.name}** for ${'`' + reason + '`'}`)
|
||||
.toJSON()
|
||||
|
||||
this.guild.members.fetch(memberId).then((m) => {
|
||||
m.send({ embeds: [warnMessage] }).then(() => {
|
||||
i.reply({ embeds: [embed] });
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
i.reply({ content: `Could not warn user ${"<@" + m.id + ">"} | They likely do not have their DMs open.` });
|
||||
});
|
||||
}).catch((e) => {
|
||||
const embed = new Embed()
|
||||
.setTitle("Member not found")
|
||||
.setDescription(`The member with the ID of ${"`" + memberId + "`"} has not been found in this Server.`)
|
||||
.setColor(0xff0000)
|
||||
.toJSON();
|
||||
i.reply({ embeds: [embed] });
|
||||
});
|
||||
});
|
||||
this.guild.members
|
||||
.fetch(memberId)
|
||||
.then((m) => {
|
||||
m.send({ embeds: [warnMessage] })
|
||||
.then(() => {
|
||||
i.reply({ embeds: [embed] })
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e)
|
||||
i.reply({ content: `Could not warn user ${'<@' + m.id + '>'} | They likely do not have their DMs open.` })
|
||||
})
|
||||
})
|
||||
.catch((e) => {
|
||||
const embed = new Embed()
|
||||
.setTitle('Member not found')
|
||||
.setDescription(`The member with the ID of ${'`' + memberId + '`'} has not been found in this Server.`)
|
||||
.setColor(0xff0000)
|
||||
.toJSON()
|
||||
i.reply({ embeds: [embed] })
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = warncommand;
|
||||
module.exports = warncommand
|
||||
|
||||
Reference in New Issue
Block a user