我发现了python discord bot模块,这是练习python的一个非常好的练习。 因此,使用discord模块,我尝试创建一个频道,同时将其放入一个变量中(我不想在创建后在列表中搜索该频道)
下面是我要执行的代码:
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = "?")
@client.event
async def on_ready():
server = client.get_server(os.environ['DISCORD_SERVER_ID])
cCurrent = client.create_channel(server, str("%s 0" %(pokeName)))
[...]
await client.send_message(cCurrent, embed=raid.embed())
执行此代码时,出现错误:
^{pr2}$所以我假设client.create_channel
还没有执行,使用python是正常的吗?在
如何同时在客户机和变量中创建新的channel对象?在
^{} 是一个协程,这意味着您必须使用
await
语法(或Python 3.4中的yield from
)来获取其值:相关问题 更多 >
编程相关推荐