PDA

Просмотр полной версии : Discord Bot проблемы


Ebatte_Sratte
20.01.2024, 20:33
Мне нужен дс бот который будет отвеччать на сообщение тем же содержанием но почему то ctx.content не работает

Вот код:

Код:






import discord
from discord.ext import commands

config = {
'token': '',
'prefix': '$',
}

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

@bot.event
async def on_message(ctx):
if ctx.author != bot.user:
await ctx.reply(ctx.content)

bot.run(config['token'])

vmprotect
20.01.2024, 20:47
попробуй методами *message.content* и *message.channel.send*

JS:






import discord
from discord.ext import commands

config = {
'token': '',
'prefix': '$',
}

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

@bot.event
async def on_message(message):
if message.author != bot.user:
await message.channel.send(message.content)

bot.run(config['token'])

Ebatte_Sratte
20.01.2024, 20:56
попробуй методами *message.content* и *message.channel.send*

JS:






import discord
from discord.ext import commands

config = {
'token': '',
'prefix': '$',
}

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

@bot.event
async def on_message(message):
if message.author != bot.user:
await message.channel.send(message.content)

bot.run(config['token'])





discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message

TravkaCode.lover()
21.01.2024, 17:13
Тут на сколько я помню проблема с Intents

Python:






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