Я не понимаю какой модуль и атрибут он от меня требует

Рейтинг: 0Ответов: 0Опубликовано: 17.01.2023

нашёл я часть бота которая должна смотреть имена людей в дискорде и после запуска он выдаёт данную новость

import asyncio
import urllib
from http import client
import discord
import json
from discord.ext import commands

file = open('config.json', 'r')
config = json.load(file)

intents = discord.Intents.all()
bot = commands.Bot(config['prefix'],intents=intents)

@bot.event
async def on_ready():
    print('BOT ONLINE')

@bot.event
async def on_member_update(before, after):
    if before.display_name != after.display_name and after.display_name is not None:  # to only run on status
        embed = discord.Embed(title=f"Changed nick")
        embed.add_field(name='User', value=before.mention)
        embed.add_field(name='Before', value=before.nick)
        embed.add_field(name='After', value=after.nick)
        # send to admin or channel you choose
        channel = client.get_channel(1064939728023080970)  # notification channel
        await channel.send(embed=embed)
        admin = client.get_user(351696934731382784)  # admin to notify
        await admin.send(embed=embed)

        if "TBU" in after.display_name:
            admin = client.get_user(351696934731382784)  # admin to notify
            await admin.send(embed=embed)
            
        if "TBU" in before.display_name and not "TBU" in after.nick:
            admin = client.get_user(351696934731382784)  # admin to notify
            await admin.send(embed=embed)

@bot.command(name= 'ping')
async def ping(ctx, input="name"):
    await ctx.send(f'{ctx.author.mention} pong')

@bot.command(name='foo')
async def ping(ctx: commands.context, *, args):
    result = str(args)
    await ctx.send(embed=discord.Embed(title=f'{result}', description="денис лох" , color=0x64ff0a))

@bot.slash_command(name='name', description='Изменение ника', pass_context=True)
async def name(ctx, member: discord.Member, nickname):
  await member.edit(nick=nickname)
  await ctx.defer()
  await asyncio.sleep(5)
  await ctx.respond(f'Ваш ник успешно сменён {member.mention} ')

bot.run(config['token'])

Это сам код это то что он пишет

     File "C:\Users\Антон\Desktop\бот дс\bot\venv\lib\site-packages\discord\client.py", line 382, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Антон\Desktop\бот дс\bot\main.py", line 25, in on_member_update
    channel = client.get_channel(1064939728023080970)  # notification channel
AttributeError: module 'http.client' has no attribute 'get_channel'

Ответы

Ответов пока нет.