为什么sendmsg代码无法正常工作?

问题描述

我一直在尝试通过复制频道ID并使用.sendmsg(ID)(消息)来使我的机器人在某个频道中说些什么,但是由于某种原因,我得到的只是“请在服务器中指定一个频道!” 这是我的代码

         elif message.content.startswith('{}sendmsg'.format(self.__cfg.pfx)):
            await message.delete()
            parts = message.content.split(' ')
            channel = self.__cfg.get_server().get_channel(parts[1])
            if channel:
                msg = ''
                for k in range(2,len(parts)):
                    msg += parts[k] + ' '

                await channel.send(msg)
            else:
                await message.channel.send('Please specify a channel in this server')
            return

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)