Python 3.x 特定不协调通道中的消息

Python 3.x 特定不协调通道中的消息,python-3.x,discord.py,Python 3.x,Discord.py,嗨,伙计们,我正在尝试让机器人在特定的频道中自动发送消息。我获取通道ID并将其传递到if条件(a_string.find('data:[])!=-1)。然而,这段代码给了我这个错误。请参阅OUTPU错误 另外,我使用的是Replit,Live是文件名(Live.py) 它是self.client.get\u channel,而不是self.get\u channel,您尚未定义该函数 channel=self.client.get_频道(828711580434169858) 您是否尝试过客户端

嗨,伙计们,我正在尝试让机器人在特定的频道中自动发送消息。我获取通道ID并将其传递到
if条件(a_string.find('data:[])!=-1)
。然而,这段代码给了我这个错误。请参阅OUTPU错误

另外,我使用的是Replit,Live是文件名(Live.py)


它是
self.client.get\u channel
,而不是
self.get\u channel
,您尚未定义该函数

channel=self.client.get_频道(828711580434169858)

您是否尝试过客户端获取频道(ID)?我想你必须用这个。是的,我试过了。它不起作用。Sytax错误你知道如何重复一些代码吗?检查应该每Xmin运行一次,否则在bot启动时只运行一次。我试过使用tim.sleep(5)进行测试,在
async def on_ready(self):
中,但没有重复。或者我应该重复我的serverJs.js文件?
from discord.ext import commands
from Naked.toolshed.shell import execute_js, muterun_js
import sys

class Live(commands.Cog):
    def __init__(self,client):
        self.client=client
    
    @commands.Cog.listener()
    async def on_ready(self):
        channel = self.get_channel(828711580434169858)
        response = muterun_js('serverJs.js')
        original_stdout = sys.stdout # Save a reference to the original standard output
        if response.exitcode == 0:
                a_string= str(response.stdout)#stampa in console
                if (a_string.find('data: []') != -1):
                    print("Streamer: Offline ")
                else:
                    print("Streamer: Online")
                    await channel.send('Live Link: https://...link....')
        else:
            sys.stderr.write(response.stderr)

    @commands.command()
    async def Live(self,ctx):
        await ctx.send('')

def setup(client):
    client.add_cog(Live(client))

OUTPUT ERROR:

Ignoring exception in on_ready
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "/home/runner/Solaris-IA/cogs/Live.py", line 12, in on_ready
    channel = self.get_channel(828711580434169858)
AttributeError: 'Live' object has no attribute 'get_channel'