more banning stuff

master
Kit Kasune 4 years ago
parent 22ad8f13b0
commit c07de1ae8e
  1. 2
      commands/ban.js
  2. 72
      commands/softban.js
  3. 33
      commands/unban.js
  4. 4
      events/message.js
  5. 30
      responses/wubzy.js

@ -47,7 +47,7 @@ module.exports = {
else {if (args[1] && !options.days /*&& (!options.notes || !options.notes.length)*/ && (!options.reason || !options.reason.length)) {args.shift(); reason = args.join(" ");}}
if (reason && reason.length > 250) {return message.channel.send("I mean I get it, they pissed you off, but do you really need to give me that much info on why you're banning them? I can't keep track of all that!");}
return user.ban({reason: reason})
return user.ban({reason: reason, days: typeof days === "number" ? days : 0})
.then(async () => {
/*let mh = await Mod.findOne({gid: message.guild.id}) || new Mod({gid: message.guild.id});
let mhcases = mh.cases;

@ -0,0 +1,72 @@
const Discord = require('discord.js');
const {Tag} = require("../util/tag");
const {TagFilter} = require("../util/tagfilter");
module.exports = {
name: "softban",
aliases: ['falseban', 'sfb'],
meta: {
category: 'Moderation',
description: "Bans a user from the server, deletes their messages, then unbans them",
syntax: '`softban <@user|userID> [reason]`',
extra: null,
guildOnly: true
},
help: new Discord.MessageEmbed()
.setTitle("Help -> SoftBan")
.setDescription("Bans a user from the server and deletes their messages, then unbans them. This is a great way to kick a member from the server while getting the message delete effect of a ban.")
.addField("Syntax", "`softban <@user|userID> [reason]`"),
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}softban <@user|userID> [reason]\``);}
if (!message.member.permissions.has("BAN_MEMBERS")) {return message.channel.send("You don't have permissions to do that!");}
if (!message.guild.me.permissions.has("BAN_MEMBERS")) {return message.channel.send("I don't have permissions to ban members in your server.");}
let user = message.guild.members.cache.get(args[0]) || message.mentions.members.first();
if (!user) {return message.channel.send("You must mention a user to softban, or provide their ID.");}
if (user.roles.highest.position >= message.member.roles.highest.position) {return message.channel.send("You don't have permissions to softban that member as they are above you in the roles list.");}
if (user.roles.highest.position >= message.guild.me.roles.highest.position) {return message.channel.send("I can't ban that member as their highest role is above mine! (Or the same as mine, too)");}
if (!user.bannable) {return message.channel.send("Hmm, it seems like I can't ban that member. This is probably a permissions issue. Or maybe they were already banned? In that case, just use `unban`");}
let options = new TagFilter([
new Tag(['r', 'reason'], 'reason', 'append'),
new Tag(['n', 'notes'], 'notes', 'append'),
new Tag(['d', 'days', 'm', 'messages'], 'days', 'append')
]).test(args.join(" "));
let reason; let days;
if (options.reason && options.reason.length) {reason = options.reason;}
if (options.days && options.days.length) {
if (isNaN(Number(options.days)) || Number(options.days) < 1 || Number(options.days) > 7 || options.days.includes('.')) {return message.channel.send("The `days` option must be a whole number between 1 and 7.");}
days = Number(options.days);
} else {days = 7;}
if (options.notes && options.notes.length > 250) {return message.channel.send("I mean I get it, they pissed you off, but do you really need to give me that much info on why you're softbanning them? I can't keep track of all that!");}
else {if (args[1] && !options.days /*&& (!options.notes || !options.notes.length)*/ && (!options.reason || !options.reason.length)) {args.shift(); reason = args.join(" ");}}
if (reason && reason.length > 250) {return message.channel.send("I mean I get it, they pissed you off, but do you really need to give me that much info on why you're softbanning them? I can't keep track of all that!");}
return user.ban({reason: reason, days: days})
.then(async () => {
/*let mh = await Mod.findOne({gid: message.guild.id}) || new Mod({gid: message.guild.id});
let mhcases = mh.cases;
mhcases.push({
members: [user.id],
punishment: "Banned",
reason: reason ? reason : "",
status: "Closed",
moderators: [message.author.id],
notes: options.notes,
history: [`${new Date().toISOString()} - ${message.author.username} - Created case`, `${new Date().toISOString()} - ${message.author.username} - Banned ${client.users.cache.get(user.id).username}`],
issued: new Date().toUTCString()
});
mh.cases = mhcases;
mh.save();*/
return message.guild.members.unban(user.id, reason)
.then(async () => {return message.channel.send("That user has been softbanned, and can now be re-invited to the server.");})
.catch(() => {return message.channel.send("Something went wrong while trying to unban that user! This means that the member has been banned, but not unbanned afterward, so you'll need to unban them using the `unban` command or by doing it manually. If the problem persists, contact my devs.");});
})
.catch(() => {return message.channel.send("Something went wrong while trying to ban that user! If the problem persists, contact my devs.");});
}
};

@ -0,0 +1,33 @@
const Discord = require('discord.js');
module.exports = {
name: "unban",
aliases: ['ub'],
meta: {
category: 'Moderation',
description: "Unban a user from the server",
syntax: '`unban <userID|@user>`',
extra: null,
guildOnly: true
},
help: new Discord.MessageEmbed()
.setTitle("Help -> Unban")
.setDescription("Unbans a user from the server, allowing them to join again if they have an invite.")
.addField("Syntax", "`unban <userID|@user>`"),
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}unban <userID|@user>\``);}
if (!message.member.permissions.has("BAN_MEMBERS")) {return message.channel.send("You don't have permissions to do that!");}
if (!message.guild.me.permissions.has("BAN_MEMBERS")) {return message.channel.send("I don't have permissions to unban members in your server.");}
let user = client.users.cache.get(args[0]) || message.mentions.users.first();
if (!user) {
user = await client.users.fetch(args[0]);
if (!user) {return message.channel.send("You must mention a user to unban, or provide their ID.");}
}
return message.guild.members.unban(user.id)
.then(async () => {return message.channel.send("I've unbanned that user!");})
.catch(() => {return message.channel.send("Something went wrong while trying to unban that user! If the problem persists, contact my devs.");});
}
};

@ -53,7 +53,7 @@ module.exports = async (client, message) => {
let command = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd));
if (command && command.name !== "blacklist") {
if (client.misc.cache.bl.guild.includes(message.guild.id)) {return message.channel.send("Your server has been blacklisted from using my commands! Shame, tsk tsk");}
if (message.guild && client.misc.cache.bl.guild.includes(message.guild.id)) {return message.channel.send("Your server has been blacklisted from using my commands! Shame, tsk tsk");}
if (client.misc.cache.bl.user.includes(message.author.id)) {return message.channel.send("You've been blacklisted from using my commands! Now what'd ya do to deserve that??");}
}
@ -68,6 +68,6 @@ module.exports = async (client, message) => {
let trigger; for (trigger of client.responses.triggers) {if (await trigger[1](message, msg, args, cmd, prefix, mention, client)) {await client.responses.commands.get(trigger[0]).execute(message, msg, args, cmd, prefix, mention, client); break;}}
} catch (e) {
let date = new Date; date = date.toString().slice(date.toString().search(":") - 2, date.toString().search(":") + 6);
console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | In ${message.guild.name}\n`)}`, e);
console.error(`\n${chalk.red('[ERROR]')} >> ${chalk.yellow(`At [${date}] | In ${message.guild ? message.guild.name : `a DM with ${message.author.username}`}\n`)}`, e);
}
};

@ -1,5 +1,9 @@
const Discord = require('discord.js');
const UserData = require('../models/user');
const ask = require('../util/ask');
module.exports = {
name: "decide",
help: new Discord.MessageEmbed()
@ -14,8 +18,8 @@ module.exports = {
if (incl(["thanks natsuki", "thank you natsuki", "ty natsuki"])) {
const r = ["Anytime!", "Anything for my creator!", "I hope I was at least a little bit helpful!",
":P Happy to help!", "You're welcome, Wubzy!", "Always happy to help you, Wubz",
"I do take tips :D"];
":P Happy to help!", "You're welcome, Wubzy!", "Always happy to help you, Wubz",
"I do take tips :D"];
return message.channel.send(r[Math.floor(Math.random() * r.length)]);
}
@ -24,5 +28,27 @@ module.exports = {
console.log(m);
if (m.author.id === client.user.id) {return message.channel.send(":heart:");}
}
if (incl(['gn natsuki', 'goodnight natsuki', 'night natsuki'])) {
const r = ["Goodnight! :)", "Night Wubbo. Hope you weren't up too late working on me!", "Sleep well!", "Yeah, I was just headed to bed, too.",
"<:awoo:750131415693393950> glad you're getting some sleep ^^ ~"];
message.channel.send(`${r[Math.floor(Math.random() * r.length)]} Want me to set your status before you go off?`);
let to = false; let sconf;
try {sconf = await message.channel.awaitMessages(m => m.author.id === "330547934951112705", {time: 15000, errors: ['time'], max: 1});}
catch {message.channel.send("Oh, I guess he already went to bed, huh? I'll just... set his status anyways-"); to = true;}
if (sconf) {sconf = sconf.first().content.trim().toLowerCase();}
if (to || ['sure', 'ye', 'mhm'].includes(sconf)) {
let w = await UserData.findOne({uid: message.author.id});
w.statusclearmode = 'manual';
w.statusmsg = "Sleeping <a:rollingcat:766362862976892958>";
w.statussetat = new Date();
let tempDate = new Date();
w.statusclearat = tempDate.setHours(tempDate.getHours() + 12);
w.statustype = 'dnd';
w.save();
if (!to) {message.channel.send("I set your status for you so you can get some sleep! Message me when you're up - I get lonely when you sleep ;-;");}
return;
}
}
}
};
Loading…
Cancel
Save