Instabot向用户发送其他不需要的消息。如何解决此错误?

发布于 2025-02-08 23:50:31 字数 1067 浏览 3 评论 0原文

import os
# to delete config folder (throws error if not done)
if os.path.isfile("path/to/file/config"):
    os.remove("path/to/file/config")

from instabot import Bot
import pandas as pd
 
# Creating bot varible
bot = Bot()
 
# Login
bot.login(username="useername", password="password")
 
# Get list of users
user_list = pd.read_excel('data/UserList.xlsx')
users = user_list['Username']
names = user_list['Full Name']
 
# Message
text = "Test"

# Iterate through and send to every user on list of users
for i in range(len(users)):
 
    # Sending messages
    bot.send_messages(text, users[i])
    # print confirmation
    print("Message sent to " + names[i])

我正在尝试在上面的Python程序中使用Instabot将DMS自动发送到从Excel文件中找到的用户列表。我目前在Excel表上有3个帐户列表,但是在运行脚本时,Instabot会向未在Excel表上列出的用户发送多个其他消息。

2022-06-20 11:40:05,977 - INFO - Going to send 23 messages.
4%|████▋                                | 1/23 [00:01<00:32,  1.49s/it]  
4%|████▋                                | 1/23 [00:02<00:47,  2.15s/it]

有什么方法可以解决此问题吗?

import os
# to delete config folder (throws error if not done)
if os.path.isfile("path/to/file/config"):
    os.remove("path/to/file/config")

from instabot import Bot
import pandas as pd
 
# Creating bot varible
bot = Bot()
 
# Login
bot.login(username="useername", password="password")
 
# Get list of users
user_list = pd.read_excel('data/UserList.xlsx')
users = user_list['Username']
names = user_list['Full Name']
 
# Message
text = "Test"

# Iterate through and send to every user on list of users
for i in range(len(users)):
 
    # Sending messages
    bot.send_messages(text, users[i])
    # print confirmation
    print("Message sent to " + names[i])

I am trying to use Instabot in the python program above to automatically send DMs to a list of users found from an excel file. I currently have 3 accounts list on the excel sheet but when running the script, instabot sends multiple additional messages to users who are not listed on the excel sheet.

2022-06-20 11:40:05,977 - INFO - Going to send 23 messages.
4%|████▋                                | 1/23 [00:01<00:32,  1.49s/it]  
4%|████▋                                | 1/23 [00:02<00:47,  2.15s/it]

Is there any way to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文