• <bdo id='lxJmC'></bdo><ul id='lxJmC'></ul>
      <tfoot id='lxJmC'></tfoot>
      <i id='lxJmC'><tr id='lxJmC'><dt id='lxJmC'><q id='lxJmC'><span id='lxJmC'><b id='lxJmC'><form id='lxJmC'><ins id='lxJmC'></ins><ul id='lxJmC'></ul><sub id='lxJmC'></sub></form><legend id='lxJmC'></legend><bdo id='lxJmC'><pre id='lxJmC'><center id='lxJmC'></center></pre></bdo></b><th id='lxJmC'></th></span></q></dt></tr></i><div id='lxJmC'><tfoot id='lxJmC'></tfoot><dl id='lxJmC'><fieldset id='lxJmC'></fieldset></dl></div>

      <small id='lxJmC'></small><noframes id='lxJmC'>

        <legend id='lxJmC'><style id='lxJmC'><dir id='lxJmC'><q id='lxJmC'></q></dir></style></legend>

      1. Discord 机器人没有响应命令

        时间:2023-10-11

        <legend id='YTgrp'><style id='YTgrp'><dir id='YTgrp'><q id='YTgrp'></q></dir></style></legend>

            <bdo id='YTgrp'></bdo><ul id='YTgrp'></ul>

            <small id='YTgrp'></small><noframes id='YTgrp'>

                <i id='YTgrp'><tr id='YTgrp'><dt id='YTgrp'><q id='YTgrp'><span id='YTgrp'><b id='YTgrp'><form id='YTgrp'><ins id='YTgrp'></ins><ul id='YTgrp'></ul><sub id='YTgrp'></sub></form><legend id='YTgrp'></legend><bdo id='YTgrp'><pre id='YTgrp'><center id='YTgrp'></center></pre></bdo></b><th id='YTgrp'></th></span></q></dt></tr></i><div id='YTgrp'><tfoot id='YTgrp'></tfoot><dl id='YTgrp'><fieldset id='YTgrp'></fieldset></dl></div>
              • <tfoot id='YTgrp'></tfoot>
                  <tbody id='YTgrp'></tbody>
                1. 本文介绍了Discord 机器人没有响应命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我一直在使用

                  import os
                  import discord
                  from discord.ext import commands
                  
                  client = commands.Bot(command_prefix = "!")
                  
                  @client.event
                  async def on_ready():
                    await client.change_presence(status=discord.Status.idle, 
                  activity=discord.Game(''))
                    print('Successfully logged in as {0.user}'.format(client))
                  
                  @client.command()
                  async def hello(ctx):
                    await ctx.send("Hello! It's great to see you!")
                  
                  client.run(os.getenv('TOKEN'))
                  

                  命令代码.我希望它会回应你好!很高兴见到你!"当我说!你好(!=前缀).但它什么也没返回.甚至没有错误.有谁知道为什么?另外,请不要显示 discord bot 不响应命令 或 Discord command bot 没有响应 (python) 因为我都尝试了,但都没有成功.

                  code for commands. I expected to have it respond "Hello! It's great to see you!" when I said !hello (! = prefix). But it returned nothing. Not even an error. Does anyone know why? Also, please don't show discord bot not responding to commands or Discord command bot doesn't responde (python) because I tried both, and neither worked.

                  推荐答案

                  因为名声不好,不能在这里聊天,所以在这里回答.您应该发布完整的代码以使工作更轻松.

                  I cant chat here because of lack of reputation so I answer it here instead. you should post the full code to make the job easier.

                  .

                  原因1:

                  您没有添加前缀.您需要一个前缀才能使用该命令

                  You didn't add a prefix. You need a prefix to use the command

                  查看您的客户端.你已经告诉前缀了吗?喜欢:

                  look onto your client. Did you tell the prefix already? like:

                  client = commands.Bot(command_prefix = "-")

                  如果是这样,添加它,它应该可以工作!

                  if so, add this and it should work!

                  .

                  原因2:

                  您没有从 discord.ext 导入命令中导入

                  You didn't import from discord.ext import commands

                  如果你想使用命令,这很重要,导入它应该可以工作!

                  this is important if you want to use commands, import that and it should work!

                  .

                  原因 3:

                  你混淆了 clientbot

                  这可能不会发生,但它会发生,你可能会在装饰器上混淆 clientbot,即 @client.command

                  this might not happen but here it goes, You might mix up client or bot on the decorator, which is @client.command

                  如果你使用客户端(如 client = commands.Bot(command_prefix = "-")),请在装饰器上使用 @client.command,而如果你使用 Bot (bot = commmands.Bot(command_prefix = "-")) 那么你应该在装饰器上使用 @bot.command.

                  if you use client (like client = commands.Bot(command_prefix = "-")), use @client.command on the decorator, while if you use Bot (bot = commmands.Bot(command_prefix = "-")) then you should use @bot.command on the decorator.

                  希望这些会有所帮助:D

                  Hope these will help :D

                  这篇关于Discord 机器人没有响应命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:你能得到“关于我"吗?Discord 机器人的功能? 下一篇:如何制作一个在 Python 中提供角色的不和谐机器人

                  相关文章

                  最新文章

                    <tfoot id='04Aov'></tfoot>
                      <bdo id='04Aov'></bdo><ul id='04Aov'></ul>
                  1. <legend id='04Aov'><style id='04Aov'><dir id='04Aov'><q id='04Aov'></q></dir></style></legend>
                  2. <i id='04Aov'><tr id='04Aov'><dt id='04Aov'><q id='04Aov'><span id='04Aov'><b id='04Aov'><form id='04Aov'><ins id='04Aov'></ins><ul id='04Aov'></ul><sub id='04Aov'></sub></form><legend id='04Aov'></legend><bdo id='04Aov'><pre id='04Aov'><center id='04Aov'></center></pre></bdo></b><th id='04Aov'></th></span></q></dt></tr></i><div id='04Aov'><tfoot id='04Aov'></tfoot><dl id='04Aov'><fieldset id='04Aov'></fieldset></dl></div>
                    1. <small id='04Aov'></small><noframes id='04Aov'>