Python 如何修改或删除“;无类别“;来自discord bot的帮助命令
这就是我得到的结果 从这个代码执行后!帮助Python 如何修改或删除“;无类别“;来自discord bot的帮助命令,python,discord,bots,Python,Discord,Bots,这就是我得到的结果 从这个代码执行后!帮助 import discord from discord.ext import commands from discord.utils import get import os import youtube_dl token = os.environ.get('DISCORD_TOKEN') client = commands.Bot(command_prefix='!') @client.event async def on_message(m
import discord
from discord.ext import commands
from discord.utils import get
import os
import youtube_dl
token = os.environ.get('DISCORD_TOKEN')
client = commands.Bot(command_prefix='!')
@client.event
async def on_message(message):
await client.process_commands(message)
channels = ['bot-commands']
if str(message.channel) in channels:
if message.content == '!help':
embed = discord.Embed(title='How to use the ImposterBot', description='Useful Commands')
embed.add_field(name='!help', value='Display all the commands')
embed.add_field(name='!music', value='Play a music playlist')
embed.add_field(name='!valorant', value='Get the most recent version of Valorant stats')
embed.add_field(name='!hello', value='Greet a user')
embed.add_field(name='!join', value='Connect the bot to a voice channel')
embed.add_field(name='!leave', value='Disconnect the bot')
await message.channel.send(content=None, embed=embed)
elif message.content == '!hello':
await message.channel.send(f'Greeting, {message.author}!')
elif message.content == '!valorant':
await message.channel.send('This feature is not ready yet')
elif message.content == '!music':
await message.channel.send('This feature is not ready yet')
@client.command(pass_context=True)
async def join(ctx):
""" join the voice channel """
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected(): # if already on a channel
await voice.move_to(channel) # move to the user's channel
else:
voice = await channel.connect()
await ctx.send(f'Joined {channel}') # if not joined yet, connect to the voice channel
@client.command(pass_context=True)
async def leave(ctx):
""" leave the voice channel """
channel = ctx.message.author.voice.channel
voice = get(client.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await ctx.send(f'Disconnecting from channel **{channel}**') # if already connected
await voice.disconnect() # disconnect
else:
await ctx.send("I'm not connected in any channel") # if not connected, send this message
client.run(token)
在我添加之前!加入并加入!离开命令,它只显示了“如何使用Importerbot”文本框。如何将“无类别”修改为“命令”或完全删除第一个文本框
它将帮助您生成更好、更详细的帮助命令,因此您不必自己编写每个命令。还应避免对命令使用on_消息事件
它将帮助您生成更好、更详细的帮助命令,因此您不必自己编写每个命令。另外,避免使用on_message event for command避免仅放置指向解决方案的外部链接,请描述您的答案。用这个来写更好的答案。避免仅仅放置解决方案的外部链接,描述你的答案。用这个来写更好的答案。