Python 3.x 肾盂造影。如何向用户发送消息\u id

Python 3.x 肾盂造影。如何向用户发送消息\u id,python-3.x,telegram-bot,Python 3.x,Telegram Bot,我想从我的config.py(config.user\u id)向id为的用户发送消息。但它不起作用。我尝试了很多方法,但总是出错 比如像这样 from aiogram import Bot import config def send_message(message): operator = Bot(config.operator_token) operator.send_message(config.user_id, message) def main(): se

我想从我的config.py(config.user\u id)向id为的用户发送消息。但它不起作用。我尝试了很多方法,但总是出错

比如像这样

from aiogram import Bot
import config

def send_message(message):
    operator = Bot(config.operator_token)
    operator.send_message(config.user_id, message)

def main():
    send_message('hi')
未关闭的客户端会话
客户端会话:
未闭合连接器
连接:['[(,,
23065.38)]']
连接器:'

如果使用Aigram,则必须使用async/Wait发送消息

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f94a9b62550>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f94a98f8040>, 
23065.38)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f94a9b3c400>'
bot = Bot(token=TOKEN)
dp = Dispatcher(bot_init)
    
@dp.message_handler(commands=['test'])
async def process_start_command(message: types.Message):
    await bot.send_message(message.from_user.id, "test message") #like this
    #await message.answer("test message") 
    #or like this