我的不和谐机器人就快完成了。它只需要6个用户,并将他们放入一个数组中,然后将6个玩家打乱成2个3人一组的团队。然而,这个代码看起来很恶心。有没有更有效的格式化方法?例如,是否可以创建一个嵌入式类,然后在需要嵌入某些内容时调用该类? 这是最终嵌入的样子: 嵌入式示例 from discord.ext import commands
from discord import utils
import discord
import asyncio
import random
import math
class queue(commands.Cog):
def __init__(self
我最近接触了OpeNweather应用程序接口,在这篇文章的帮助下我做了一个简单的当前天气命令:How to make a weather command using discord.py v1.4.1 我是API的新手,所以我需要使用Forecast API的帮助(文档可以在这里找到https://openweathermap.org/api/hourly-forecast) 我正在为我的机器人使用discord.py重写
好的,所以我正在制造一个不和谐的机器人,但是当我输入k!帮助这个消息出现:
No Category:
help Shows this message
info
kill
mention
prank
repeat
roast
say
Type k!help command for more info on a command.
You can also type k!help category for more info on a category.
我注意到了上面的no category,我想知道我是否能为命
我在想,如果我要做的话,是否可以做一个稍微有点“子帮助”的命令;帮助静音--它将展示如何对每个命令使用静音命令等等。有点像dyno,你能做什么?帮助(命令名),它显示了命令的用法。我已经完成了我自己的help命令,但是我正在考虑添加它,所以如果有人这样做了;help命令名会向他们展示用法,比如我在底部尝试过的参数,但我认为这是行不通的。如果你知道怎么做,请告诉我
@client.hybrid_command(name = "help", with_app_command=True, description="Get a list of commands")
@c
我知道我是新来的,但我有个问题要问你:
如果您想用Python编写一个带有特殊齿轮的不和谐的机器人,并用以下方式替换默认的help命令,该怎么办:
@commands.command(pass_context=True)
async def help(self,ctx,*cog:str):
"""Gives you info on my cogs *and* their commands."""
if not cog:
halp=discord.Embed(title='Cog Listing and Un
我正在创建一个彩虹嵌入命令,但我真的不知道它应该如何工作。也许您可以查看并帮助我创建命令:D
下面是代码
@bot.commands()
async def rainbowembed(ctx, *, message):
embed = discordEmbed(description=message)
ctx.send(embed=embed)
for i in range(5):
# On this point i dont know what to do...
# I want to switch the color of the e
如何为discord.py斜杠命令添加权限?在斜杠命令中没有@has_permissions()。
@slash.slash(
name="kick",
description="Kicks member from the server",
options=[manage_commands.create_option(
name = "member",
description = "Who do you want to kick?",
option_type
我正在跟踪,但由于某种原因,我试图通过
cf create-service DataCache free DataCacheInst
我得到以下错误:
FAILED
Server error, status code: 403, error code: 10003,
message: You are not authorized to perform the requested action
根据错误消息,我没有特权,但我不确定为什么我可以成功地使用bluemix凭据登录,请按照教程中的指示查看市场服务,以及输入命令时。
cf org-users MyOrgName
输出是emtpy的,就
好的,这是我的代码
import discord
from discord.ext import commands
TOKEN = 'THIS_IS_MY_BOT_TOKEN'
client = commands.Bot(command_prefix = '.')
@client.event
async def on_message(message):
# we do not want the bot to reply to itself
if message.author == client.user:
return
我一直试图为我的服务器创建一个不和谐的机器人,但我被一个问题卡住了。如何使用youtube_dl播放音乐而无需下载?现在我使用的是:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
它下载歌曲,然后我播放它。它可以工作,但需要大约15秒来完成所有这些,这并不坏,但我想知道是否有任何方法可以让它更快?例如,Rythm Bot是即时的。
提前感谢您给予的帮助。