Как настроить отключение self-бота в discord

Помогите пожалуйста настроить отключение self-бота в дискорде. При bot.close или bot.logout выдает ошибку:

Traceback (most recent call last):
  File "C:\Users\BOTANIQUE\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "D:\DiscordBot\main.py", line 61, in on_message
    await msg.reply(resp)
  File "C:\Users\BOTANIQUE\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\message.py", line 1358, in reply
    return await self.channel.send(content, reference=self, **kwargs)
  File "C:\Users\BOTANIQUE\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\abc.py", line 1065, in send
    data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
  File "C:\Users\BOTANIQUE\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
import asyncio
from discord.ext import commands
from neuralintents import GenericAssistant
import requests
import json
import eel, time
from sqlhelper import AddData, forStart, db, curs
from jinja2 import *
import os, sys
from Verify import Verify
from asyncio import proactor_events


eel.init("web")
env = Environment(loader=FileSystemLoader('web/templates'))
template = env.get_template('bot.html')
deb = db.execute("SELECT login FROM data")
bot = commands.Bot(command_prefix=".")
@eel.expose
def registry(login, token):
    AddData(login, token)

    return login, token
with open('web/templates/botPage.html', 'w') as f:
    f.write(template.render(deb=deb))

@eel.expose
def GetDataFromSelect(login, channel_id):
    for i in db.execute(f"SELECT token FROM data WHERE login = '{login}'"):
        tok = i[0]
        NeurBot(tok, channel_id)
        headers = {
            'authorization': f'{tok}'
        }

@eel.expose
def NeurBot(acc_token, channel_id):
        neural_bot = GenericAssistant(intents="intents.json")
        neural_bot.train_model()
        neural_bot.save_model()



        headers = {
            'authorization':f'{acc_token}'
        }

        # OTA4NDM3OTAxNjMxNzA5Mjc1.Gs2HfT.I6-xkvORtbtm82DVobj7G-VW_AaS_kcMzL6TLU
        # 980491435801460839
        @bot.event
        async def on_message(msg):
            if(msg.author != bot.user):
                r = requests.get(f'https://discord.com/api/v9/channels/{channel_id}/messages', headers=headers)
                await asyncio.sleep(4)
                jas = json.loads(r.text)

                message = jas[0]['content']

                resp = neural_bot.request(message)
                print(message + " "+ resp)
                await msg.reply(resp)

        bot.run(acc_token, bot=False)


@eel.expose
def StartBot(acc_token):
    bot.run(acc_token, bot=False)

@eel.expose
def StopBot():
    @bot.command
    async def exit(ctx):
        print('Bla bla')  # Что-то делаешь
        await bot.process_commands(ctx)

@eel.expose
def Referal(login, password, link, token):
    Verify(login, password, link, token)
eel.start("templates/index.html", jinja_templates='templates', size=(800, 600))

Ответы (0 шт):