ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   Discord Bot проблемы (https://forum.antichat.xyz/showthread.php?t=1501132)

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

Цитата:

Сообщение от monotype

попробуй методами *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
(
)
)



Время: 12:35