<function command at 0x7f5e402b46a8> 帮助命令中显示的字符串 - py-cord

<function command at 0x7f5e402b46a8> string displaying in help command - py-cord

好的,所以我正在使用 py-cord 并且我的帮助命令遇到了这个烦人的问题。我附上了显示该问题的屏幕截图。

基本上有一个不应该显示的字符串,我正在尝试找出导致它显示的原因。有谁知道是什么原因造成的,因为我什至不知道从哪里开始。

我知道显示的研究不足,但这完全是因为我真的不知道从哪里开始尝试解决这个问题。这是我第一次看到 python 不和谐机器人发生这种情况,所以我完全被难住了。

任何能帮助我解决这个问题的提示或指示都将不胜感激。

提及的字符串是:<function command at 0x7f5e402b46a8>.

截图

代码

这是我的代码: bot.py

import discord
import os
import sys
import time
import asyncio
import logging

from config import EMBED_THUMBNAIL, PREFIX, TOKEN, TWITCH, BLUE, GITHUB_REPO, CLIENT_VERSION
from discord.ext import commands

from typing import List

activity = discord.Streaming(name='with cogs | {}help'.format(PREFIX), url='https://twitch.tv/{}'.format(TWITCH))

client = commands.Bot(
    command_prefix=commands.when_mentioned_or('{}'.format(PREFIX)),
    description='Multi-purpose discord bot built in discord.py\n\n**Version**: {}\n**Repo**: [Socket-Development/Socket-Discord-Bot]({})'.format(CLIENT_VERSION, GITHUB_REPO),
    activity=activity,
    status=discord.Status.online
)

  
class Help(commands.Cog):
    def __init__(self, client):
        self.client = client

class CustomHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        destination = self.get_destination()
        embed = discord.Embed(color=BLUE, description='{}'.format(commands.command))
        embed.set_thumbnail(url='{}'.format(EMBED_THUMBNAIL))
        for page in self.paginator.pages:
            embed.description += page
            await destination.send(embed=embed)

client.help_command = CustomHelp()

for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        client.load_extension('cogs.{}'.format(filename[:-3]))
        print('Loaded cogs.{}'.format(filename[:-3]))
    else:
        print('Unable to load cogs.{}'.format(filename[:-3]))
                
debug_logger = logging.getLogger('discord')
debug_logger.setLevel(logging.DEBUG)
debug_handler = logging.FileHandler(filename='debug.log', encoding='utf-8', mode='w')
debug_handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
debug_logger.addHandler(debug_handler)
        
client.run('{}'.format(TOKEN))

config.py

# Imports
import discord
import os

from dotenv import load_dotenv

load_dotenv()
# Env Variables
TOKEN = os.getenv('CLIENT_TOKEN')
PREFIX = os.getenv("CLIENT_PREFIX")
GIPHY_API = os.getenv("GIPHY_TOKEN")
TENOR_API = os.getenv('TENOR_TOKEN')
TWITCH = os.getenv('TWITCH_CHANNEL')
OWNER_ID = os.getenv('OWNER_ID')
OWNER_NAME = os.getenv('OWNER_NAME')
DEV_TEAM = os.getenv('DEVELOPMENT_TEAM_NAME')
DEV_ID = os.getenv('DEV_ID')
DEV_NAME = os.getenv('DEV_NAME')
GITHUB_REPO = os.getenv('GITHUB_REPO')
EMBED_THUMBNAIL = os.getenv('EMBED_THUMBNAIL_URL')
EMBED_IMAGE = os.getenv('EMBED_IMAGE_URL')
CLIENT_VERSION = os.getenv('VERSION')

# Color Variables
RANDOM = discord.Color.random()
BLUE = discord.Color.blue()
BLURPLE = discord.Color.blurple()
GOLD = discord.Color.gold()
RED = discord.Color.red()
GREEN = discord.Color.green()
DARKRED = discord.Color.dark_red()
DARKBLUE = discord.Color.dark_blue()
DARKGOLD = discord.Color.dark_gold()

requirements.txt

py-cord
aiohttp
async-timeout
asyncio
asynctest
Babel
decorator
discord
prettytable
requests
setuptools
TenGiphPy
typing
typing-extensions
python-dotenv

我 运行 离开 Python 3.6.8 并且正在使用 py-cord 库。

也许,尝试改变

class CustomHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        ...
    embed = discord.Embed(color=BLUE, description='{}'.format(commands.command))
    ...

class CustomHelp(commands.MinimalHelpCommand):
    async def send_pages(self):
        ...
    embed = discord.Embed(color=BLUE, description='')
    ...