我一直想弄清楚齿轮是怎么和不和谐.py重写,我设法让一个机器人只有一个齿轮工作。问题是,bot可以识别来自一个cog的命令,但不能识别另一个cog。你知道吗
{cd1}中的导入
cogs = [
'cogs.basic',
'cogs.mod']
@bot.event
async def on_ready():
print("Arthur Morgan")
print("version: "+version)
game = discord.Game("rebuilding.....")
await bot.change_presence(status=discord.Status.idle, activity=game)
for extension in cogs:
bot.load_extension(extension)
return
内部basic.py
这里的命令似乎可以工作
import discord
from discord.ext import commands
class Basic(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.command(name='ping', aliases=['p'])
async def ping(self, ctx):
await ctx.send("Pong! :ping_pong:")
def setup(bot):
bot.add_cog(Basic(bot))
mod.py
输出中的命令this
import discord
from discord.ext import commands
class Mod(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.command()
async def pong(self, ctx):
await ctx.send("Ping!")
def setup(bot):
bot.add_cog(Mod(bot))
有人知道怎么修吗?你知道吗
在只加载一个cog之后,协程在到达
return
时停止。你知道吗相关问题 更多 >
编程相关推荐