added changelog command

This commit is contained in:
ry 2020-01-05 21:07:57 +01:00
parent 8ae4072260
commit 5ee9d4106d
3 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,48 @@
const Command = require('../../src/structures/Command');
module.exports = class Changelog extends Command {
constructor() {
super({
name: 'changelog',
description: 'View the latest changes of the bot',
aliases: ['chl', 'c'],
module: 'General',
cooldown: 5,
guildOnly: false,
developerOnly: false,
nsfw: false
});
}
async command(ctx) {
let isDev;
if (ctx.vars.developers.find((dev) => ctx.author.id == dev.id)) isDev = true
const ValidActions = /(set|view)/g
let action = ctx.args[0]
ctx.args.shift()
if (!action.match(ValidActions)) return ctx.send(`You can only ${isDev ? ctx.utils.format.code('view/set'): ctx.utils.format.code('view')} a Changelog`)
// ctx.db.backend.get()
let Changelog = ctx.args.join(' ').split('|')
let version = Changelog[0].replace(/\./g, '_')
let text = Changelog[1]
// console.log(action, version, text)
if (action === 'set') {
if (!isDev) return;
await ctx.db.backend.set(version.trim(), text)
ctx.send('Changelog set, posting...')
ctx.client.channels.find(c => c.id == '572515873156235307').send(`**__Version ${version.replace(/\_/g, '.')}__**\n\n${text.trim()}`)
return ctx.send('Sent.')
} else if (action === 'view') {
let Change = ctx.db.backend.get(version)
if (Change === null) return ctx.send(`That is not a valid Version (or it's not in my Database).\nMy latest version is ${ctx.utils.format.bold(ctx.vars.version)}.`)
ctx.send(`**__Version ${version.replace(/\_/g, '.')}__**\n\n${Change}`)
}
}
}

View File

@ -1,5 +1,5 @@
const ora = require("ora");
const config = require("../../vars");
const vars = require("../../vars");
const chalk = require("chalk");
const BotSpinner = new ora({
discardStdin: false
@ -13,7 +13,7 @@ const ServerSpinner = new ora({
module.exports = async = {
starting: async function () {
BotSpinner.text = `${config.name} - v${config.version} is starting`;
BotSpinner.text = `${vars.name} - v${vars.version} is starting`;
BotSpinner.spinner = "moon";
BotSpinner.start();
return BotSpinner;
@ -22,7 +22,7 @@ module.exports = async = {
return BotSpinner.stop();
},
hasStarted: async function () {
BotSpinner.succeed(`${config.name} - v${config.version} has started`);
BotSpinner.succeed(`${vars.name} - v${vars.version} has started`);
return;
},
shardReady: async function (text) {

View File

@ -1,6 +1,6 @@
module.exports = {
name: 'Thaldrin',
version: '3.6.2',
version: '3.6.4',
color: '#ff995d',
hostname: '127.2.11.1',
//hostname: 'localhost',