Ok, so I’m working with py-cord
and am having this annoying issue with my help command. I’ve attatched a screenshot displaying the issue.
Basically there is a string displaying that shouldn’t be and I’m trying to figure out what is causing it to display. Does anybody know what is causing it as I have no idea where to even begin on this.
I’m aware of a lack of research displayed, but that is due entirely to the fact that I literally have no idea where to even begin trying to figure this one out. It’s the first time I’ve ever seen this happen with python discord bots so I’m completely stumped.
Any tips or pointers to help me figure this one out would be much appreciated.
The string in mention is: <function command at 0x7f5e402b46a8>
.
Screenshot
Code
Here is my code:
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
I’m running off of Python 3.6.8
and am using the py-cord
library.
>Solution :
Perhaps, try changing
class CustomHelp(commands.MinimalHelpCommand):
async def send_pages(self):
...
embed = discord.Embed(color=BLUE, description='{}'.format(commands.command))
...
to
class CustomHelp(commands.MinimalHelpCommand):
async def send_pages(self):
...
embed = discord.Embed(color=BLUE, description='')
...