mirror of
https://github.com/thaldrin/thaldrin.git
synced 2024-08-14 23:57:21 +00:00
add first few commands
This commit is contained in:
parent
b7af64f0ba
commit
908d330378
2 changed files with 66 additions and 5 deletions
32
src/modules/developer/exec.ts
Normal file
32
src/modules/developer/exec.ts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import Command from "../../handler/structures/Command";
|
||||||
|
import { exec } from "child_process";
|
||||||
|
import { Context } from "../../utils/types";
|
||||||
|
|
||||||
|
export = class Exec extends Command {
|
||||||
|
constructor() {
|
||||||
|
super({
|
||||||
|
name: "exec",
|
||||||
|
description: "Execute Shell Commands",
|
||||||
|
aliases: [
|
||||||
|
'sh',
|
||||||
|
'ex'
|
||||||
|
],
|
||||||
|
cooldown: 0,
|
||||||
|
dev: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async command(ctx: Context) {
|
||||||
|
await ctx.channel.send(`Executing \`${ctx.args.join(' ')}\`...`).then(async (message) => {
|
||||||
|
|
||||||
|
exec(`${ctx.args.join(' ')}`, async (error, stdout, stderr) => {
|
||||||
|
await ctx.channel.send(("```bash\n" + stdout + "```"), { split: true })
|
||||||
|
await message.delete()
|
||||||
|
if (stderr) return ctx.channel.send("stderr:\n```bash\n" + stderr + "```")
|
||||||
|
if (error !== null) {
|
||||||
|
return ctx.channel.send("error:\n```bash\n" + error + "```")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
import { Context } from '../../utils/types';
|
import { Context } from '../../utils/types';
|
||||||
import Command from '../../handler/structures/Command';
|
import Command from '../../handler/structures/Command';
|
||||||
|
import { MessageEmbed } from 'discord.js';
|
||||||
|
import config from '../../../config';
|
||||||
|
|
||||||
export = class Info extends Command {
|
export = class Info extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -7,14 +9,41 @@ export = class Info extends Command {
|
||||||
name: "info",
|
name: "info",
|
||||||
description: "Show Information about the Bot",
|
description: "Show Information about the Bot",
|
||||||
aliases: ["about"],
|
aliases: ["about"],
|
||||||
// module: "General",
|
cooldown: 0
|
||||||
cooldown: 2,
|
|
||||||
// AuthorPermissions: ["MANAGE_GUILD"],
|
|
||||||
dev: false
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async command(ctx: Context) {
|
async command(ctx: Context) {
|
||||||
return console.log("Information Command")
|
let devs: string[] | string = []
|
||||||
|
let contribs: string[] | string = []
|
||||||
|
if (ctx.config.variables.developers.length > 1) {
|
||||||
|
ctx.config.variables.developers.forEach(dev => {
|
||||||
|
// @ts-ignore
|
||||||
|
return devs.push(`\n**- [${ctx.client.users.cache.get(dev.id)?.username}](${dev.link})**`)
|
||||||
|
})
|
||||||
|
devs = devs.join(' ')
|
||||||
|
} else {
|
||||||
|
devs = `**[${ctx.client.users.cache.get(ctx.config.variables.developers[0].id)?.username}](${ctx.config.variables.developers[0].link})**`
|
||||||
|
}
|
||||||
|
if (ctx.config.variables.contributors.length > 1) {
|
||||||
|
ctx.config.variables.contributors.forEach(contributor => {
|
||||||
|
// @ts-ignore
|
||||||
|
return contribs.push(`\n**- [${contributor.nick}](${contributor.link})** - ${contributor.reason}`)
|
||||||
|
})
|
||||||
|
contribs = contribs.join(' ')
|
||||||
|
} else {
|
||||||
|
contribs = `**[${ctx.config.variables.contributors[0].nick}](${ctx.config.variables.contributors[0].link})** - ${ctx.config.variables.contributors[0].reason}`
|
||||||
|
}
|
||||||
|
let InfoEmbed = new MessageEmbed()
|
||||||
|
.setDescription(`
|
||||||
|
Made by ${devs}`)
|
||||||
|
.addField("Contributors", `${contribs}`, false)
|
||||||
|
.addField("Source", config.variables.source, true)
|
||||||
|
.addField("Support Server", `[${ctx.client.guilds.cache.get(ctx.config.variables.support.id)?.name}](${ctx.config.variables.support.invite})`, true)
|
||||||
|
.addField("Website", `[${ctx.config.variables.website}](https://${ctx.config.variables.website})`, true)
|
||||||
|
.setColor(ctx.config.variables.color)
|
||||||
|
.setFooter(`${config.variables.name}, ${config.variables.tagline}`, config.variables.avatar)
|
||||||
|
|
||||||
|
ctx.channel.send(InfoEmbed)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue