diff --git a/commands/admin/activateStrikes.js b/commands/admin/activateStrikes.js index 085983a..da97c1b 100644 --- a/commands/admin/activateStrikes.js +++ b/commands/admin/activateStrikes.js @@ -54,7 +54,7 @@ module.exports = class leave extends Command }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } } diff --git a/commands/admin/createchannel.js b/commands/admin/createchannel.js index 9d6e39b..479ad15 100644 --- a/commands/admin/createchannel.js +++ b/commands/admin/createchannel.js @@ -62,7 +62,7 @@ const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } } diff --git a/commands/admin/createvoicechannel.js b/commands/admin/createvoicechannel.js index c3ba06a..c113728 100644 --- a/commands/admin/createvoicechannel.js +++ b/commands/admin/createvoicechannel.js @@ -79,7 +79,7 @@ const {EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType, }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } } diff --git a/commands/admin/guilds.js b/commands/admin/guilds.js index c1acc5b..153373c 100644 --- a/commands/admin/guilds.js +++ b/commands/admin/guilds.js @@ -54,7 +54,7 @@ class Guilds extends Command }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } diff --git a/commands/admin/purge.js b/commands/admin/purge.js index 57b32e1..006400e 100644 --- a/commands/admin/purge.js +++ b/commands/admin/purge.js @@ -78,7 +78,7 @@ const {Command} = require('../../lib.js') }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } }module.exports = purge; diff --git a/commands/admin/removerustcommitschannel.js b/commands/admin/removerustcommitschannel.js index 7a0e00b..c4e1a42 100644 --- a/commands/admin/removerustcommitschannel.js +++ b/commands/admin/removerustcommitschannel.js @@ -69,7 +69,7 @@ const {Command, } = require('../../lib.js'); }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } diff --git a/commands/admin/setFreeGamesChannel.js b/commands/admin/setFreeGamesChannel.js index 424073a..c5fb97f 100644 --- a/commands/admin/setFreeGamesChannel.js +++ b/commands/admin/setFreeGamesChannel.js @@ -73,7 +73,7 @@ class setfreegameschannel extends Command{ }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } function addChannel(id, name) diff --git a/commands/admin/setrustcommitschannel.js b/commands/admin/setrustcommitschannel.js index b83c592..3527b0f 100644 --- a/commands/admin/setrustcommitschannel.js +++ b/commands/admin/setrustcommitschannel.js @@ -39,7 +39,7 @@ class setrustcommitschannel extends Command{ ); const filter = i => i.customId === 'RemoveRustCommitsNewChannelMessage'; - const Mesage = await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); + const Message = await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); collector.on('collect', async m => { @@ -48,7 +48,7 @@ class setrustcommitschannel extends Command{ }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } function addChannel(id, name) diff --git a/commands/admin/strike.js b/commands/admin/strike.js index 61b5284..8c051bb 100644 --- a/commands/admin/strike.js +++ b/commands/admin/strike.js @@ -71,7 +71,7 @@ const strikeM = require('../../models/strikes'); }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } async confirmArgs(message,args) diff --git a/commands/music/activateMusic.js b/commands/music/activateMusic.js index 249624c..7075013 100644 --- a/commands/music/activateMusic.js +++ b/commands/music/activateMusic.js @@ -55,7 +55,7 @@ module.exports = class leave extends Command }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } } diff --git a/commands/music/play.js b/commands/music/play.js index 3884e72..b060c14 100644 --- a/commands/music/play.js +++ b/commands/music/play.js @@ -129,7 +129,7 @@ module.exports = class play extends Command }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) } } diff --git a/commands/search/searchAnime.js b/commands/search/searchAnime.js index ffbce76..873e99c 100644 --- a/commands/search/searchAnime.js +++ b/commands/search/searchAnime.js @@ -56,16 +56,16 @@ class anime extends Command{ { message.delete(); m.message.delete(); - if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id, this.client); + if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id); }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({components:[]}) }) /** * @param {Number} id */ - async function sendMessage(id, client) + async function sendMessage(id) { const data = await new Anilist().getAnimeInfo(id); // console.log('Command: SearchChar: SendMessage: Data', data) @@ -104,7 +104,7 @@ class anime extends Command{ .setStyle(ButtonStyle.Primary), ); const filter = i => i.customId === randomID; - await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); + const sentMessage = await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); collector.on('collect', async m => { @@ -112,7 +112,7 @@ class anime extends Command{ }); collector.on('end', async ()=> { - client.guilds.cache.get(sentMessage.guildId).channels.cache.get(sentMessage.channelId).messages.cache.get(sentMessage.id).edit({ components: [] }); + sentMessage.edit({components:[]}) }) } } diff --git a/commands/search/searchChar.js b/commands/search/searchChar.js index 7a2f2b3..6c95277 100644 --- a/commands/search/searchChar.js +++ b/commands/search/searchChar.js @@ -51,22 +51,22 @@ class char extends Command{ // console.log(data.length, embeds.length, embeds) const filter = i => i.customId.slice(0,-1) === randomID; - const sentMessage = await message.channel.send({ephemeral: true, embeds, components: [row] }); + const Message = await message.channel.send({ephemeral: true, embeds, components: [row] }); const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); collector.on('collect', async m => { message.delete(); m.message.delete(); - if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id, this.client); + if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id); }); collector.on('end', async ()=> { - this.client.guilds.cache.get(sentMessage.guildId).channels.cache.get(sentMessage.channelId).messages.cache.get(sentMessage.id).edit({ components: [] }); + Message.edit({components:[]}) }) /** * @param {Number} id */ - async function sendMessage(id, client) + async function sendMessage(id) { const data = await new Anilist().getCharInfo(id); data.description = data.description.replaceAll('~!', '').replaceAll('!~', '').replaceAll(/<[^>]*>/g, ''); @@ -96,15 +96,15 @@ class char extends Command{ .setStyle(ButtonStyle.Primary), ); const filter = i => i.customId === randomID; - await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); - const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 }); + const sentMessage = await message.channel.send({ephemeral: true, embeds: [embed], components: [row] }); + const collector = message.channel.createMessageComponentCollector({ filter, time: 6})//0000 }); collector.on('collect', async m => { m.message.delete(); }); collector.on('end', async ()=> { - client.guilds.cache.get(sentMessage.guildId).channels.cache.get(sentMessage.channelId).messages.cache.get(sentMessage.id).edit({ components: [] }); + sentMessage.edit({components:[]}) }) } } diff --git a/commands/search/searchManga.js b/commands/search/searchManga.js index 6852490..d683cc4 100644 --- a/commands/search/searchManga.js +++ b/commands/search/searchManga.js @@ -58,16 +58,16 @@ class manga extends Command{ { message.delete(); m.message.delete(); - if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id, this.client); + if(m.customId[m.customId.length-1]!=4) sendMessage(data[m.customId[m.customId.length-1]].id); }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({components:[]}) }) /** * @param {Number} id */ - async function sendMessage(id, client) + async function sendMessage(id) { const data = await new Anilist().getMangaInfo(id); data.description = data.description.replaceAll('~!', '').replaceAll('!~', '').replaceAll(/<[^>]*>/g, ''); @@ -100,7 +100,7 @@ class manga extends Command{ }); collector.on('end', async ()=> { - client.guilds.cache.get(sentMessage.guildId).channels.cache.get(sentMessage.channelId).messages.cache.get(sentMessage.id).edit({ components: [] }); + sentMessage.edit({components:[]}) }) } } diff --git a/lib.js b/lib.js index cd04030..5627ebf 100644 --- a/lib.js +++ b/lib.js @@ -528,7 +528,7 @@ class ErrorMessage }); collector.on('end', async ()=> { - this.client.guilds.cache.get(Message.guildId).channels.cache.get(Message.channelId).messages.cache.get(Message.id).edit({ components: [] }); + Message.edit({ components: [] }); }) }