|
|
@ -18,6 +18,12 @@ module.exports = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
|
|
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
|
|
|
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}dnd [clearMode] <reason>\``);} |
|
|
|
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}dnd [clearMode] <reason>\``);} |
|
|
|
|
|
|
|
args = msg.startsWith(prefix) |
|
|
|
|
|
|
|
? message.content.slice(prefix.length).trim().split(/ +/g) |
|
|
|
|
|
|
|
: msg.startsWith('<@!') |
|
|
|
|
|
|
|
? message.content.slice(4 + client.user.id.length).trim().split(/ +/g) |
|
|
|
|
|
|
|
: message.content.slice(3 + client.user.id.length).trim().split(/ +/g) |
|
|
|
|
|
|
|
.slice(2); |
|
|
|
let tu = await UserData.findOne({uid: message.author.id}) |
|
|
|
let tu = await UserData.findOne({uid: message.author.id}) |
|
|
|
? await UserData.findOne({uid: message.author.id}) |
|
|
|
? await UserData.findOne({uid: message.author.id}) |
|
|
|
: new UserData({uid: message.author.id}); |
|
|
|
: new UserData({uid: message.author.id}); |
|
|
@ -29,6 +35,7 @@ module.exports = { |
|
|
|
let reason = args.join(" "); |
|
|
|
let reason = args.join(" "); |
|
|
|
if (reason.length > 150) {return message.channel.send("That status a bit long; keep it under 150 characters.");} |
|
|
|
if (reason.length > 150) {return message.channel.send("That status a bit long; keep it under 150 characters.");} |
|
|
|
if (reason.match(/<@&\d+>|@everyone/gm)) {return message.channel.send("I won't ping any roles or @ everyone!");} |
|
|
|
if (reason.match(/<@&\d+>|@everyone/gm)) {return message.channel.send("I won't ping any roles or @ everyone!");} |
|
|
|
|
|
|
|
if (reason.split(/\n/gm).length > 10) {return message.channel.send("That's too many lines!");} |
|
|
|
tu.statustype = 'dnd'; |
|
|
|
tu.statustype = 'dnd'; |
|
|
|
tu.statusmsg = reason.trim(); |
|
|
|
tu.statusmsg = reason.trim(); |
|
|
|
tu.statussetat = new Date(); |
|
|
|
tu.statussetat = new Date(); |
|
|
|