-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Hab3925/master
Move things over
- Loading branch information
Showing
6 changed files
with
125 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,91 @@ | ||
module.exports.run = async (client, message, args) => { | ||
//if guild doesent have an entery in the enmap | ||
if (!client.mute.has(message.guild.id)) { | ||
client.mute.set(message.guild.id, { | ||
role: undefined, | ||
users: [] | ||
}) | ||
} | ||
|
||
|
||
let obj = client.mute.get(message.guild.id) | ||
|
||
// if there is no `Muted` role, send an error | ||
if (!mutedRole) | ||
return message.channel.send('There is no Muted role on this server, make a role and call it "Muted"'); | ||
if (!args[0]) return message.channel.send("You need to tell me who to mute!") | ||
|
||
const target = message.mentions.members.first(); | ||
target.roles.add(mutedRole); | ||
//if user mentions a role | ||
if (args[0].match(/<@&\d{18}>/g)) { | ||
if (obj.role != undefined) { | ||
//if there already is a role, ask if user wants to replace it. | ||
const newRole = await client.awaitReply(message, "You have already saved a muted role on this server, do you want to replace it?", 60000) | ||
if (newRole.toLowerCase() == "y" || newRole.toLowerCase() == "yes") { | ||
obj.role = args[0].replace(/<|@|&|>/g, "") | ||
client.mute.set(message.guild.id, obj) | ||
message.channel.send("Mute role set to " + args[0]) | ||
} else { | ||
message.channel.send(`Mute role remains unchanged. (<@&${obj.role}>)`) | ||
} | ||
} else { | ||
//If not, set the said role. | ||
obj.role = args[0].replace(/<|@|&|>/g, "") | ||
client.mute.set(message.guild.id, obj) | ||
message.channel.send("Mute role set to " + args[0]) | ||
} | ||
//if user mentioned a person | ||
} else if (args[0].match(/<@!?\d{18}>/g)) { | ||
const mutedRole = message.guild.roles.cache.get(obj.role); | ||
if (!message.guild.roles.cache.has(obj.role)) return message.channel.send("The current mute role doesent exist! You need to set a new one.") | ||
|
||
const target = message.mentions.members.first(); | ||
try { | ||
target.roles.add(mutedRole); | ||
} catch { | ||
return message.channel.send("I dont have the permissions to mute people! Make sure i can edit roles and that my role is over the muted role!") | ||
} | ||
|
||
if (!args[1]) args[1] = "" | ||
|
||
// if they provided a time | ||
if (args[1].match(/\d+/g)) { | ||
obj.users.push({ | ||
user: args[0].replace(/<|@|!|>/g, ""), | ||
time: args[1] * 3600000 + new Date().getTime() | ||
}) | ||
client.mute.set(message.guild.id, obj) | ||
message.channel.send(`Muted ${args[0]} for ${args[1]} hours.`) | ||
client.channels.cache.get(client.logchn.get(message.guild.id)).send(`<@${message.author.id}> muted ${args[0]} for ${args[1]} hours.`) | ||
|
||
//wait for timer to expire | ||
setTimeout(() => { | ||
obj = client.mute.get(message.guild.id) | ||
|
||
// remove user from database | ||
obj.users.forEach((user, i) => { | ||
if (user.user == args[0].replace(/<|@|!|>/g, "")) { | ||
obj.users.splice(i, 1) | ||
client.mute.set(message.guild.id, obj) | ||
} | ||
}); | ||
target.roles.remove(mutedRole) | ||
}, args[1] * 3600000); | ||
} else { | ||
// if there is no time | ||
obj.users.push({ | ||
user: args[0].replace(/<|@|!|>/g, ""), | ||
time: undefined | ||
}) | ||
client.mute.set(message.guild.id, obj) | ||
message.channel.send(`Muted ${args[0]}`) | ||
client.channels.cache.get(client.logchn.get(message.guild.id)).send(`<@${message.author.id}> muted ${args[0]}`) | ||
|
||
} | ||
} | ||
} | ||
|
||
exports.help = { | ||
name: "mute", | ||
desc: "Mute a user.", | ||
aliases: [""], | ||
aliases: [], | ||
permLvl: 1, | ||
hidden: false, | ||
category: "admin", | ||
usage: "mute [@user] (time)" | ||
usage: "mute [@user] (hours)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports.run = async (client, message, args) => { | ||
message.channel.send(`You can leave a suggestion on nolt! (https://volcanoids.nolt.io/) \nMake sure someone didnt suggest what you want to suggest before you post!`) | ||
} | ||
|
||
exports.help = { | ||
name: "nolt", | ||
desc: "Make cap", | ||
aliases: ["n"], | ||
permLvl: 0, | ||
hidden: true, | ||
category: "volc", | ||
usage: "nolt" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters