【发布时间】:2021-07-05 19:29:39
【问题描述】:
我想从 Json 文件中获取频道名称。 但我总是得到频道名称和服务器 ID。 我怎样才能得到频道的名称?
代码:
@client.event
async def on_message(message):
with open('channel.json', 'r') as f:
jchannel = json.load(f)
jchannel[str(message.guild.id)] # What should I change?
print(f"{jchannel}") # Result = "823878792563916810": "826875862980755476"
Json:
{ “823878792563916810(服务器 ID)”:“826875862980755476(通道 ID)” }
【问题讨论】:
标签: python json discord discord.py