KIRIK12
@KIRIK12

Почему выдает ошибку UnknownMessage?

module.exports = {
	name: 'verify',
	description: 'Verifing the user',
	execute(message, args) {
        const channel = `<#741329939336527902>`
        if(message.author.bot) return;
        if(message.channel.id === '741584167728316477') 
            message.delete();
        if(message.content.toLowerCase() === '!verify' && message.channel.id === '741584167728316477')
        {
            message.delete().catch(err => console.log(err));
            const role = message.guild.roles.cache.get('688192159811108907');
            if (role) {
            message.member.roles.add(role);
            console.log("Role added!");
            if (args[1]) {
                if (!message.guild.me.hasPermission('MANAGE_NICKNAMES')) return message.channel.send('I don\'t have permission to change your nickname!');
                message.member.setNickname(args[1]);
            }
            else {
                return message.author.send(`Пожалуйста, напишите свой игровой ник в канале ${channel}!`)
            }
            }
            try{
                something
                } catch (err) {
                console.log(err)
                }
        }
    },
};

Выдает ошибку:
(node:14888) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
    at RequestHandler.execute (C:\Users\Кирилл\Documents\discord-bots\verification-bot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14888) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14888) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  • Вопрос задан
  • 317 просмотров
Решения вопроса 1
@dmitry-toster
вангую из-за повторного вызова удаления сообщения, т.е у вас срабатывает это условие
if(message.channel.id === '741584167728316477') message.delete();

и то, что идет ниже
if(message.content.toLowerCase() === '!verify' && message.channel.id === '741584167728316477')
   message.delete().catch(err => console.log(err));

вам надо эти два условия объединить в одно
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы