@Hlorka

Как решить ошибку ReferenceError: bot is not defined?

Когда запускаю бота вылезает ошикба:
ReferenceError: bot is not defined
2022-09-26T06:39:09.466811+00:00 app[worker.1]: at Object.<anonymous> (/app/main.js:24:1)
2022-09-26T06:39:09.466811+00:00 app[worker.1]: at Module._compile (node:internal/modules/cjs/loader:1126:14)
2022-09-26T06:39:09.466812+00:00 app[worker.1]: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
2022-09-26T06:39:09.466812+00:00 app[worker.1]: at Module.load (node:internal/modules/cjs/loader:1004:32)
2022-09-26T06:39:09.466813+00:00 app[worker.1]: at Function.Module._load (node:internal/modules/cjs/loader:839:12)
2022-09-26T06:39:09.466813+00:00 app[worker.1]: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
2022-09-26T06:39:09.466813+00:00 app[worker.1]: at node:internal/main/run_main_module:17:47
2022-09-26T06:39:09.595019+00:00 heroku[worker.1]: Process exited with status 1
2022-09-26T06:39:09.654017+00:00 heroku[worker.1]: State changed from up to crashed


Код main.js:
const { Player } = require('discord-player');
const { Client, GatewayIntentBits } = require('discord.js');

global.client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.MessageContent
    ],
   disableMentions: 'everyone',
});

client.config = require('./config');

global.player = new Player(client, client.config.opt.discordPlayer);

require('./src/loader');
require('./src/events');

client.login(client.config.app.token);

bot.login(process.env.BOT_TOKEN)
  • Вопрос задан
  • 265 просмотров
Решения вопроса 1
fenrir1121
@fenrir1121
Начни с документации
В коде нет переменной bot. Вместо bot поставить client
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

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

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