forked from Supositware/Haha-Yes
Fixed the ability to unblacklist
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
72d474f06a
commit
10f2be27ef
8 changed files with 13 additions and 11 deletions
|
@ -56,7 +56,7 @@ class byeCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
||||||
.then(async messages => {
|
.then(async messages => {
|
||||||
let messageContent = messages.map(messages => messages.content);
|
let messageContent = messages.map(messages => messages.content);
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
const body = {guildID: message.guild.id, channelID: message.channel.id, message: args.message};
|
const body = {guildID: message.guild.id, channelID: message.channel.id, message: args.message};
|
||||||
await leaveChannel.update(body, {where: {guildID: message.guild.id}});
|
await leaveChannel.update(body, {where: {guildID: message.guild.id}});
|
||||||
return message.channel.send(`The leave message have been set with ${args.message}`);
|
return message.channel.send(`The leave message have been set with ${args.message}`);
|
||||||
|
|
|
@ -30,7 +30,7 @@ class logCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
||||||
.then(async messages => {
|
.then(async messages => {
|
||||||
let messageContent = messages.map(messages => messages.content.toLowerCase());
|
let messageContent = messages.map(messages => messages.content.toLowerCase());
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
await LogStats.destroy({where: {guild: message.guild.id}});
|
await LogStats.destroy({where: {guild: message.guild.id}});
|
||||||
return message.channel.send('Log channel has been disabled!');
|
return message.channel.send('Log channel has been disabled!');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TagCommand extends Command {
|
||||||
return message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
return message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
||||||
.then(async messages => {
|
.then(async messages => {
|
||||||
let messageContent = messages.map(messages => messages.content.toLowerCase());
|
let messageContent = messages.map(messages => messages.content.toLowerCase());
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
Tag.destroy({where: {serverID: message.guild.id}});
|
Tag.destroy({where: {serverID: message.guild.id}});
|
||||||
return message.channel.send('Tags have been reset.');
|
return message.channel.send('Tags have been reset.');
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +93,7 @@ class TagCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
||||||
.then(async messages => {
|
.then(async messages => {
|
||||||
let messageContent = messages.map(messages => messages.content.toLowerCase());
|
let messageContent = messages.map(messages => messages.content.toLowerCase());
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
const body = {trigger: args.trigger, response: args.response, ownerID: message.author.id, serverID: message.guild.id};
|
const body = {trigger: args.trigger, response: args.response, ownerID: message.author.id, serverID: message.guild.id};
|
||||||
await Tag.update(body, {where: {trigger: args.trigger, serverID: message.guild.id}});
|
await Tag.update(body, {where: {trigger: args.trigger, serverID: message.guild.id}});
|
||||||
return message.channel.send(`tag have been set to ${args.trigger} : ${args.response}`);
|
return message.channel.send(`tag have been set to ${args.trigger} : ${args.response}`);
|
||||||
|
|
|
@ -55,7 +55,7 @@ class welcomeCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
|
||||||
.then(async messages => {
|
.then(async messages => {
|
||||||
let messageContent = messages.map(messages => messages.content);
|
let messageContent = messages.map(messages => messages.content);
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
const body = {guildID: message.guild.id, channelID: message.channel.id, message: args.message};
|
const body = {guildID: message.guild.id, channelID: message.channel.id, message: args.message};
|
||||||
await joinChannel.update(body, {where: {guildID: message.guild.id}});
|
await joinChannel.update(body, {where: {guildID: message.guild.id}});
|
||||||
return message.channel.send(`The join message have been set with ${args.message}`);
|
return message.channel.send(`The join message have been set with ${args.message}`);
|
||||||
|
|
|
@ -53,7 +53,7 @@ class addResponseCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
let messageContent = messages.map(messages => messages.content);
|
let messageContent = messages.map(messages => messages.content);
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
const body = {trigger: args.trigger, response: args.response, type: args.type};
|
const body = {trigger: args.trigger, response: args.response, type: args.type};
|
||||||
autoResponse.update(body, {where: {trigger: args.trigger}});
|
autoResponse.update(body, {where: {trigger: args.trigger}});
|
||||||
return message.channel.send(`autoresponse have been set to ${args.trigger} : ${args.response} with type: ${args.type}`);
|
return message.channel.send(`autoresponse have been set to ${args.trigger} : ${args.response} with type: ${args.type}`);
|
||||||
|
|
|
@ -32,16 +32,18 @@ class blacklistCommand extends Command {
|
||||||
if (!blacklist) {
|
if (!blacklist) {
|
||||||
const body = {userID: args.userID};
|
const body = {userID: args.userID};
|
||||||
userBlacklist.create(body);
|
userBlacklist.create(body);
|
||||||
return message.channel.send(`The following user have been blacklisted: ${this.client.users.resolve(args.userID).tag} (${args.userID})`);
|
return message.channel.send(`The following ID have been blacklisted: ${args.userID}`);
|
||||||
} else {
|
} else {
|
||||||
message.channel.send('This user is already blacklisted, do you want to unblacklist him? y/n');
|
message.channel.send('This user is already blacklisted, do you want to unblacklist him? y/n');
|
||||||
const filter = m => m.content && m.author.id === message.author.id;
|
const filter = m => m.content && m.author.id === message.author.id;
|
||||||
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
|
console.log(messages);
|
||||||
let messageContent = messages.map(messages => messages.content);
|
let messageContent = messages.map(messages => messages.content);
|
||||||
if (messageContent === 'y' || messageContent === 'yes') {
|
console.log(messageContent);
|
||||||
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
userBlacklist.destroy({where: {userID:args.userID}});
|
userBlacklist.destroy({where: {userID:args.userID}});
|
||||||
return message.channel.send(`The following user have been unblacklisted: ${this.client.users.resolve(args.userID).tag} (${args.userID})`);
|
return message.channel.send(`The following ID have been unblacklisted: ${args.userID}`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
|
@ -39,7 +39,7 @@ class serverBlacklistCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
let messageContent = messages.map(messages => messages.content);
|
let messageContent = messages.map(messages => messages.content);
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
guildBlacklist.destroy({where: {guildID:args.guildID}});
|
guildBlacklist.destroy({where: {guildID:args.guildID}});
|
||||||
return message.channel.send(`The guild with the following id have been unblacklisted: ${args.guildID}`);
|
return message.channel.send(`The guild with the following id have been unblacklisted: ${args.guildID}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class TwitterBlacklistCommand extends Command {
|
||||||
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
|
||||||
.then(messages => {
|
.then(messages => {
|
||||||
let messageContent = messages.map(messages => messages.content);
|
let messageContent = messages.map(messages => messages.content);
|
||||||
if (messageContent == 'y' || messageContent == 'yes') {
|
if (messageContent[0] === 'y' || messageContent[0] === 'yes') {
|
||||||
TwitterBlacklist.destroy({where: {userID:args.userID}});
|
TwitterBlacklist.destroy({where: {userID:args.userID}});
|
||||||
return message.channel.send(`The user with the following id have been unblacklisted: ${args.userID}`);
|
return message.channel.send(`The user with the following id have been unblacklisted: ${args.userID}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue