This repository has been archived by the owner on Aug 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_prefix.js
38 lines (38 loc) · 1.58 KB
/
cmd_prefix.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
const fs = require('fs');
module.exports = function(msg, bot, args) {
if (args) {
if (args.length > 4) {
bot.createMessage(msg.channel.id, ":x: ``The prefix cant be bigger than 4 characters!``")
} else {
if (msg.member.permission.has("manageGuild") == true) { // check perms
// if everything is true execute this:
global.prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"))
global.prefixes[msg.channel.guild.id] = {
prefixes: args
};
fs.writeFile("./prefixes.json", JSON.stringify(global.prefixes), (err) => {
if (err) {
console.log(err)
}
})
const lembed = {
"embed": {
"title": "Prefix set!",
"description": "Custom prefix set to " + args,
"color": 16193101,
"timestamp": new Date(),
"footer": {
"icon_url": "https://cdn.discordapp.com/embed/avatars/0.png",
"text": "~prefix"
}
}
};
msg.channel.createMessage(lembed)
} else {
bot.createMessage(msg.channel.id, ":x: ``You dont have the permissions to this! (You need manage guild)``");
}
}
} else {
bot.createMessage(msg.channel.id, ":x: ``You need to specify a prefix!``")
}
}