【发布时间】:2021-03-04 11:29:27
【问题描述】:
@bot.command(name='setannounce')
async def setannounce(context, *, arg2):
with open("data2.json", "w+") as f:
json.dump(arg2, f, indent=2)
setannounce = arg2
@bot.command(name='announce')
async def announce(context, *, arg1):
embed = discord.Embed(title="**OpticPvP**", description="", color=0xc94747)
embed.add_field(name="Announcement", value=arg1 , inline=False)
embed.set_footer(text="Optic Development")
try:
inchan = bot.get_channel(announceChannel)
await inchan.send(embed=embed)
except NameError:
await context.send('Announcement channel is not set, please use `.setannounce <channel id>')
所以基本上我想要它,所以在不和谐中我可以将 .setannounce 作为 1 次设置的东西,也许是更新的东西,所以如果我这样做 .setannounce
【问题讨论】:
-
你是从哪里得到announceChannel变量的?
标签: python json discord discord.py