Let’s say I have only channel id and message id, how to delete it? Here is example what I mean by this: getChannelById(000).getMessageById(000).deleteMessage();
Something like this client.guilds.get('guildID').channels.get('channelID').fetchMessage('messageID').then(message => message.delete());
Would it work for you i don’t know, because there are different versions of discord.js and i made example for 11.6.4 version. So you need to go to discord.js.org and choose your version of d.js, to make sure you using proper methods for fetching, deleting and everything else.
For example, in 11.6.4 to fetch a message you need to use fetchMessage, but if you on 12.2.0 all you need is just fetch.
I tested the code (which i provided) and it works just fine and can delete any specified message.
Just look at the code you wrote and try to understand the hierarchy. Why you trying to get channel before guild? Also why are you storing basic information in .env file? And i hope use using quotes on specified IDs.
In V12, try using something like this: client.channels.cache.get(channel => channel.id === channelid).fetch(messageid).then(message => message.delete())
might be wrong, but you cant use .get(channelid) and .fetchMessage(messageid) anymore in V12