const google_images = require("free-google-images")
const getPing = module.exports.getPing = (msg, ping, allowSelf) => {
- if (ping && ping.startsWith("<@!") && ping.endsWith(">")) {
- const id = ping.slice("<@!".length, -">".length)
+ if (ping && ping.startsWith("<\\@!") && ping.endsWith(">")) {
+ const id = ping.slice("<\\@!".length, -">".length)
if (!allowSelf && id == msg.author.id) {
msg.reply("Please mention a user other than yourself")
return
}
-
+
if (msg.guild.members.cache.get(id))
return id
}
module.exports.uppercase = str => str.slice(0, 1).toUpperCase() + str.slice(1)
-module.exports.requestCommand = (help, onRequest, onAccept) => new Object({
+module.exports.requestCommand = (help, info, onRequest, onAccept) => new Object({
params: "<player>",
- help: "Request to " + help + " another user",
+ help: "Request to " + help,
func: (msg, [targetPing], {requests}) => {
const target = getPing(msg, targetPing, false)
if (target) {
const err = onRequest(msg, target)
- if (err)
+ if (err) {
msg.reply(err)
- else
+ } else {
+ msg.channel.send(`<@!${target}>: <@!${msg.author.id}> ${info}. Type !accept to accept or !deny to deny.`)
+
requests[target] = {
origin: msg.author.id,
func: onAccept,
}
+ }
}
-
+
}
})
}
}
})
-
-module.exports.stripPings = str => str
- .replace(/<@!/g, "<@!")
- .replace(/<@&/g, "<@&")
- .replace(/@here/g, "@here")
- .replace(/@everyone/g, "@everyone")