Fixed the ability to unblacklist

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
loicbersier 2020-05-08 01:26:09 +02:00
parent 72d474f06a
commit 10f2be27ef
8 changed files with 13 additions and 11 deletions

View file

@ -56,7 +56,7 @@ class byeCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
.then(async messages => {
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};
await leaveChannel.update(body, {where: {guildID: message.guild.id}});
return message.channel.send(`The leave message have been set with ${args.message}`);

View file

@ -30,7 +30,7 @@ class logCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
.then(async messages => {
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}});
return message.channel.send('Log channel has been disabled!');
} else {

View file

@ -49,7 +49,7 @@ class TagCommand extends Command {
return message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
.then(async messages => {
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}});
return message.channel.send('Tags have been reset.');
} else {
@ -93,7 +93,7 @@ class TagCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
.then(async messages => {
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};
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}`);

View file

@ -55,7 +55,7 @@ class welcomeCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000, max: 1, errors: ['time'] })
.then(async messages => {
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};
await joinChannel.update(body, {where: {guildID: message.guild.id}});
return message.channel.send(`The join message have been set with ${args.message}`);

View file

@ -53,7 +53,7 @@ class addResponseCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
.then(messages => {
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};
autoResponse.update(body, {where: {trigger: args.trigger}});
return message.channel.send(`autoresponse have been set to ${args.trigger} : ${args.response} with type: ${args.type}`);

View file

@ -32,16 +32,18 @@ class blacklistCommand extends Command {
if (!blacklist) {
const body = {userID: args.userID};
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 {
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;
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
.then(messages => {
console.log(messages);
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}});
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 => {

View file

@ -39,7 +39,7 @@ class serverBlacklistCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
.then(messages => {
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}});
return message.channel.send(`The guild with the following id have been unblacklisted: ${args.guildID}`);
}

View file

@ -48,7 +48,7 @@ class TwitterBlacklistCommand extends Command {
message.channel.awaitMessages(filter, {time: 5000 * 1000, max: 1, errors: ['time'] })
.then(messages => {
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}});
return message.channel.send(`The user with the following id have been unblacklisted: ${args.userID}`);
}