-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.js
69 lines (42 loc) · 1.57 KB
/
template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Start of prefixes, only alter config
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*/
const fs = require("fs")
const botConfig = JSON.parse(fs.readFileSync('config.json', 'utf8'));
const prefix = botConfig["prefix"]
const config = {
name: "name", //name of module (no .js)
version:"1.0.0", //version
commands: ["command"], //commands without prefix
description: "This is a description", //description (this shows up in help)
prefix: prefix
}
function setup(){
var data = JSON.parse(fs.readFileSync('lib/modules.json', 'utf8'));
if (data[config.name] == undefined || data[config.name]["version"] != config.version || data[config.name]["prefix"] != config.prefix){
data[config.name] = config;
fs.writeFile("lib/modules.json", JSON.stringify(data), (error) => {});
console.log("Done setting up")
}
}
setup(config)
module.exports = {
main: main_
}
/*
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
End of prefixes ------------------------
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
*/
function main_(content, command, messageObj){
//Your code. Use if or switch statements to alter between the different command types you listed in config.commands.
if(command == ""){
}else if(command == "help"){
let help = ``
let name = config["name"].charAt(0).toUpperCase() + config["name"].substr(1,config["name"].length).toLowerCase();
messageObj.channel.send({embed: {color: parseInt(botConfig.botColor), title: name, description: help}})
}
}
//Export functions