Skip to content

Commit

Permalink
2.1.2 Update
Browse files Browse the repository at this point in the history
New commands
  • Loading branch information
theopcoder committed Jul 3, 2021
1 parent 748ca29 commit bb68def
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Token.js
package-lock.json
json.sqlite
DeveloperFolder
.vscode
.vscode
docs
6 changes: 3 additions & 3 deletions BotData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const BotConfiguration = require("./BotConfiguration.js");
const chalk = require("chalk");

var BotData = [
Version = "2.1.1",
BuildID = "2021.06.15.2.1.1",
VN = "2.1.1 Update",//VN stands for Version Name
Version = "2.1.2",
BuildID = "2021.07.02.2.1.2",
VN = "2.1.2 Update",//VN stands for Version Name
Developer = "TheMLGDude#2177 | theopcoder",
DeveloperDiscord = "TheMLGDude#2177",
DeveloperGitHub = "theopcoder",
Expand Down
20 changes: 8 additions & 12 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
==================================================
Title: 2.1.1 Update
Version: 2.1.1
DevID: 2021.06.15.2.1.1
Date: 6/15/2021
Description: A small update with a few new features and a couple bug fixes
Title: 2.1.2 Update
Version: 2.1.2
DevID: 2021.07.02.2.1.2
Date: 07/02/2021
Description: New commands

Additions/Changes:
1. Added -temperature. You can now do conversions inbetween celcius and Fahrenheit
2. Added -spelling. Tell people they made a grammatical error!
3. Added -afk
4. Updated README with website link and updated some badges
1. Added -pf to view bot performance
2. Added -power to restart/power off the bot.

Deletions:
1.

Bug Fixes:
1. Fixed -Suggestion not working
2. Fixed -purge not working adding another argument after number
3. Fixed -purge log message not showing correct number greater than 9
1. Fixed -settings to have the correct class name

Dependencies:
1.
Expand Down
47 changes: 47 additions & 0 deletions commands/bot/performance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const BotConfiguration = require("../../BotConfiguration.js");
const { Command } = require("discord.js-commando");
const BotData = require("../../BotData.js");
const discord = require("discord.js");
const db = require("quick.db");
const os = require('os');

module.exports = class PerformanceCommand extends Command {
constructor(client) {
super(client, {
name: 'pf',
group: 'bot',
memberName: 'pf',
description: `Performance command for the bot!`,
});
}

run(message, args) {
if (message.guild === null){
message.reply(DMMessage);
return;
}
if (!message.member.hasPermission("MANAGE_MESSAGES")){
const PermissionErrorMessage = new discord.MessageEmbed()
.setColor("#FF0000")
.setDescription(`${PermissionError}`)
message.channel.send(PermissionErrorMessage).then(message => {
message.delete({timeout: 10000})
});
return;
}

var usedMemory = os.totalmem() -os.freemem(), totalMemory = os.totalmem();
var getpercentage = ((usedMemory/totalMemory) * 100).toFixed(2) + '%'

const PerformanceMessage = new discord.MessageEmbed()
.setTimestamp()
.setColor("#d3d3d3")
.setTitle("Bot Performance")
.setDescription(`
**Used RAM:** ${getpercentage}
**RAM:** ${(usedMemory/ Math.pow(1024, 3)).toFixed(2)}
**Ping:** ${Date.now() - message.createdTimestamp} ms
`)
message.channel.send(PerformanceMessage);
}
};
57 changes: 57 additions & 0 deletions commands/bot/power.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const { Command, CommandoClient } = require("discord.js-commando");
const BotConfiguration = require("../../BotConfiguration.js");
const BotData = require("../../BotData.js");
const token = require("../../Token.js");
const discord = require("discord.js");
const client = new CommandoClient();
const db = require("quick.db");
const chalk = require("chalk");

module.exports = class PowerCommand extends Command {
constructor(client) {
super(client, {
name: 'power',
group: 'bot',
memberName: 'power',
description: `Power commands for the bot.`,
});
}

run(message, args) {
if (message.guild === null){
message.reply(DMMessage);
return;
}
if(!message.member.hasPermission("ADMINISTRATOR")){
const PermissionErrorMessage = new discord.MessageEmbed()
.setColor("#FF0000")
.setDescription(`${PermissionError}`)
message.channel.send(PermissionErrorMessage).then(message => {
message.delete({timeout: 10000})
});
return;
}
let words = args.split(' ');
let PowerAction = words.slice(0).join(' ');
if (!PowerAction) return message.reply(":warning: Do you want to restart or shutdown the bot? Ex: -power <restart or shutdown>").then(message => {
message.delete({timeout: 10000});
});

if (PowerAction == "restart"){
console.log(chalk.red(`${message.author.tag} Restarted the bot!`));
message.channel.send("Restarting Bot...");
client.destroy().then(() => {
client.login(key);
});
message.channel.send(`The bot is back online!`);
}
if (PowerAction == "shutdown"){
console.log(chalk.red(`${message.author.tag} Shut down the bot!`));
message.channel.send(`Shutting down bot...`).then(message => {
message.channel.send("The bot is now offline.").then(() => {
process.exit();
});
});
}
}
};
2 changes: 1 addition & 1 deletion commands/bot/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const BotData = require("../../BotData.js");
const discord = require("discord.js");
const db = require("quick.db");

module.exports = class BugCommand extends Command {
module.exports = class SettingsCommand extends Command {
constructor(client) {
super(client, {
name: 'settings',
Expand Down

0 comments on commit bb68def

Please sign in to comment.