【发布时间】:2022-01-21 03:45:52
【问题描述】:
所以,我目前有这个命令可以用 discord py 更改不和谐频道的标题。该命令在每个通道中运行几次,然后在每个通道的基础上中断(或在大约 6 分钟后完成该命令)。
import api
import discord
from discord.ext import commands
client = discord.Client()
client = commands.Bot(command_prefix=["pp.", "Pp.", "PP.", "pP."])
@client.command(pass_context=True)
async def progress_update(ctx, new_emoji):
if ctx.message.channel.name[0] not in ["????", "????", "????", "????"]:
await ctx.send("That is not a valid channel to run **progress_update** in.\nPlease run this command in a challenge channel")
return
if new_emoji not in ["????", "????", "????", "????"]:
await ctx.send("That is not a valid emoji.\nPlease use one of the following: ????, ????, ????, ????")
return
new_name = new_emoji + ctx.message.channel.name[1:]
temp = await ctx.message.channel.edit(name=new_name)
await ctx.send("Progress updated!")
client.run(api.api)
我不知道问题可能是什么。它似乎只发生在ctx.message.channel.edit 命令上,因为如果我键入错误的命令,我仍然可以查看错误消息(在not it 语句中)。
【问题讨论】:
标签: python python-3.x async-await discord discord.py