Написал следующий код для бота discord
import discord
from discord.ext import commands
intents = discord.Intents.all()
intents.members = True
client = discord.Client(intents=discord.Intents.default())
warnings = {}
@client.event
async def on_message(message):
if message.content.startswith('/muser'):
user = message.mentions[0]
embed = discord.Embed(title=f"Information about {user.name}", color=0x00ff00)
embed.set_thumbnail(url=user.avatar_url)
embed.add_field(name="Name", value=user.name, inline=True)
embed.add_field(name="ID", value=user.id, inline=True)
embed.add_field(name="Status", value=user.status, inline=True)
embed.add_field(name="Highest Role", value=user.top_role, inline=True)
await message.channel.send(embed=embed)
if message.content.startswith('/mban'):
user = message.mentions[0]
await message.guild.ban(user)
await message.channel.send(f'{user.name} has been banned.')
if message.content.startswith('/mwarn'):
user = message.mentions[0]
if user.id not in warnings:
warnings[user.id] = 0
warnings[user.id] += 1
await message.channel.send(f'{user.name} has been warned. Total warnings: {warnings[user.id]}')
if warnings[user.id] == 3:
await message.guild.kick(user)
await message.channel.send(f'{user.name} has been kicked for reaching 3 warnings.')
client.run('TOKEN')
Вроде как все подключил, но выдает следующие:
2023-02-07 03:03:53 INFO discord.client logging in using static token
2023-02-07 03:03:55 INFO discord.gateway Shard ID None has connected to Gateway
При этом бот подключился, но не работают все команды