Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gfhdhytghd committed Sep 13, 2024
1 parent 4377915 commit 07df889
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 11 additions & 1 deletion qqBot/likeeveryday.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import requests
import sys
port = sys.argv[1]
# 请求 URL
url = "http://127.0.0.1:port"
url = f"http://127.0.0.1:{port}"

# 获取好友列表
response = requests.post(f"{url}/get_friend_list")
friend_list = response.json()

data_list = friend_list['data']

# 确保列表长度超过 500,否则不会有足够的数据可选
if len(data_list) > 500:
# 随机选出 500 个对象
selected_friends = random.sample(data_list, 500)
# 更新 friend_list 数据为选出的 500 个
friend_list['data'] = selected_friends

if friend_list["status"] == "ok" and friend_list["retcode"] == 0:
for friend in friend_list["data"]:
user_id = friend["user_id"]
Expand Down
5 changes: 4 additions & 1 deletion qqBot/startd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ fi
while true; do
# 获取当前小时和分钟
current_time=$(date +"%H:%M")
echo $current_time
current_M=$(date +"%M")
if [ "current_M" == "00" ];then
if [ "$current_M" == "00" ];then
echo 'reach :00'
#检查是否为早上7点
if [ "$current_time" == "07:00" ]; then
echo 'reach 7:00'
source ./venv/bin/activate
# 运行 Python 脚本
for qqid in "${runidlist[@]}"; do
Expand Down

0 comments on commit 07df889

Please sign in to comment.