불화 로봇 가지 않을 것이 온라인

0

질문

나는 그냥 시작한 배우 python 및 내 불화 로봇지 않습니다. 그것은 단지 말 "프로세스를 종료와 함께 출구호 0". 이 없다는 오류 코드입니다.

여기 나의 코드입니다. 입력한 이미지는 여기에 설명

discord discord.py python
2021-11-23 04:23:03
3
0

추가 await client.process_commands(ctx)@client.event 이 필요하지 않 괄호(). 코드를 사용하여 아래와 같습니다:

@client.event
async def on_message(ctx):
  if ctx.author == client.user:
    return

  await client.process_commands(ctx)

이 전체 코드의 경우 그것은 여전히 작동하지 않:

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="!")


@bot.event
async def on_ready():
  print('We are logged in!')

@bot.event
async def on_message(message):
   if message.author==bot.user: 
     return

   await bot.process_commands(message)

@bot.command()
async def ping(message) :
   await message.channel.send("Pong!!")

bot.run("TOKEN")
2021-11-23 05:57:23

감사합니다,그러나 로봇은 여전히 오프라인입니다.
Shir0

내가 편집한 내 게시물을 전체 코드를 이것을보십시오.
Siddhant Chauhan

그것은 여전히 작동하지 않습니다. 에 오류가 없는 코드 및 후 프로그램을 실행 그것은 단지"말하는 과정이 완료 하드 0"입니다.
Shir0

는 없다는 것을 의미한 오류 코드에서 하지만 당신은 확인 설정에서의 IDE: stackoverflow.com/a/61883867/16203851
Siddhant Chauhan
0

당신이 대신

import os
import discord
from discord.ext import commands

discord_token = "Your Token"

client = discord.Client()

bot = commands.Bot(cloient_prefix="!")

@client.command()
async def on_ready():
  print("running")

other codes here...

bot.run(discord_token)
2021-11-23 05:19:54
-1

코드에 당신은 잘못이 정확:

import os 
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="!") # you don't need an extra discord.client Bot is enough
token = os.getenv("TOKEN")
#you should not run the program here you should run it at last

@bot.event #no need for brackets
async def on_ready():
  print("running")

@bot.event
async def on_message(ctx):
  if ctx.author == client.user:
    return

@bot.command(name="span",description="YOUR DESCRIPTION HERE") # it is command and not commands
async def span_(ctx,amount:int,*,message):
  for i in range(amount):
    await ctx.send(message)

bot.run(token) #you should run the bot now only and this will work perfectly!

당신을 찾을 수 있습니다에 대한 설명서 discord.py 여기에.

2021-11-23 06:00:41

감사합니다,그러나 로봇은 여전히 오프라인입니다. 오류 발견
Shir0

당신이 있어야 합니다.env 파일 이 토큰 또는 다른 이동
DevER-M

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................