rework command system
parent
9bab1d3600
commit
2759f0d96f
54
index.js
54
index.js
|
@ -110,7 +110,20 @@ bot.on("privmsg", (e) => {
|
|||
bot.notice(e.nick, bold + "+--------------- WallopsServ ---------------+")
|
||||
return
|
||||
}
|
||||
if (e.target === conf.channel && e.message === conf.cmdPrefix + "sendlog" && admin.includes(genIdentity2(e))){
|
||||
if (e.target === conf.channel && admin.includes(genIdentity2(e)) && e.message.startsWith(conf.cmdPrefix)) {
|
||||
let args = e.message.slice(conf.cmdPrefix.length).split(" ")
|
||||
let cmd = args.shift()
|
||||
switch (cmd) {
|
||||
case "rehash":
|
||||
logS(genIdentity2(e) + " rehashed the config")
|
||||
conf = JSON.parse(fs.readFileSync("wallopsserv.json"))
|
||||
map = conf.relays
|
||||
exemptUsers = conf.cooldownExempt
|
||||
admin = conf.admin
|
||||
map2 = conf.shortMap
|
||||
bot.notice(conf.channel, "Rehashed.")
|
||||
break
|
||||
case "sendlog":
|
||||
logS(genIdentity2(e) + " requested the log")
|
||||
transporter.sendMail({
|
||||
from: conf.mail.sender,
|
||||
|
@ -127,16 +140,37 @@ bot.on("privmsg", (e) => {
|
|||
]
|
||||
})
|
||||
bot.notice(conf.channel, "Log sent.")
|
||||
return
|
||||
break
|
||||
case "forcelock":
|
||||
if (args.length < 1) return bot.say(conf.channel, "No type specified")
|
||||
if (args[0] !== "i" && args[0] !== "m") return bot.say(conf.channel, "Invalid lock type")
|
||||
logS("Channel locked: spam")
|
||||
lockActive = true
|
||||
bot.say(conf.channel, bold + "Locking channel for 60 seconds")
|
||||
bot.mode(conf.channel, "+" + args[0])
|
||||
bot.raw("locops", "#wallops has been locked due to request")
|
||||
transporter.sendMail({
|
||||
from: conf.mail.sender,
|
||||
to: conf.mail.receiver,
|
||||
subject: "#wallops has been locked (on demand)",
|
||||
text: "#wallops has been locked via the request of " + genIdentity2(e) + " with mode +" + args[0] + ".\nA log has been attached.",
|
||||
attachments: [
|
||||
{
|
||||
filename: "log.txt",
|
||||
contentDisposition: "inline",
|
||||
content: log.join("\n"),
|
||||
contentType: "text/plain"
|
||||
}
|
||||
]
|
||||
})
|
||||
setTimeout(() => {
|
||||
lockActive = false
|
||||
bot.say(conf.channel, bold + "Channel unlocked")
|
||||
bot.mode(conf.channel, "-" + args[0])
|
||||
logS("Channel unlocked")
|
||||
}, 60000)
|
||||
break
|
||||
}
|
||||
if (e.target === conf.channel && e.message === conf.cmdPrefix + "rehash" && admin.includes(genIdentity2(e))){
|
||||
logS(genIdentity2(e) + " rehashed the config")
|
||||
conf = JSON.parse(fs.readFileSync("wallopsserv.json"))
|
||||
map = conf.relays
|
||||
exemptUsers = conf.cooldownExempt
|
||||
admin = conf.admin
|
||||
map2 = conf.shortMap
|
||||
bot.notice(conf.channel, "Rehashed.")
|
||||
return
|
||||
}
|
||||
if (e.target === conf.channel && e.message === conf.cmdPrefix + "hostmask") {
|
||||
|
|
Reference in New Issue