【发布时间】:2020-09-09 22:51:20
【问题描述】:
我的目标:遍历不和谐服务器频道列表并中继消息(不包括消息来自的服务器)
当前结果:它一遍又一遍地循环播放并发布到所有频道。也在消息来源的频道中发帖。
class MyClient(discord.Client):
async def on_ready(self):
print('{0} is in the building!'.format(self.user))
print(self.user.id)
print('------')
async def on_message(self, message):
# relay cod messages
if message.channel.id in cod_chanlist:
for chan in cod_chanlist:
if message.channel.id == chan:
pass
else:
game_channel = client.get_channel(chan)
await game_channel.send('{0.author}: {0.content}'.format(message))
【问题讨论】:
标签: python discord discord.py