Spaces:
Paused
Paused
Update bot_main.py
Browse files- bot_main.py +5 -5
bot_main.py
CHANGED
|
@@ -241,7 +241,8 @@ async def on_ready():
|
|
| 241 |
@tasks.loop(seconds=5) # 每 5 秒檢查一次,視需求調整
|
| 242 |
async def check_updates():
|
| 243 |
global last_cnt, last_to_z
|
| 244 |
-
|
|
|
|
| 245 |
url = 'https://master.ntut.edu.tw/Query/CheckIn.aspx' # 替換成你要爬的網址
|
| 246 |
response = requests.get(url)
|
| 247 |
soup = BeautifulSoup(response.text, 'html.parser')
|
|
@@ -261,12 +262,11 @@ async def check_updates():
|
|
| 261 |
to_z += 1
|
| 262 |
|
| 263 |
# 檢查是否有變動
|
| 264 |
-
await
|
| 265 |
if cnt != last_cnt or to_z != last_to_z:
|
| 266 |
-
|
| 267 |
-
await channel.send(f'🎓 更新通知:目前完成報到人數為 {cnt},備取備取剩下 {to_z} 人。')
|
| 268 |
if(cnt<36 & to_z==0):
|
| 269 |
-
await
|
| 270 |
|
| 271 |
last_cnt = cnt
|
| 272 |
last_to_z = to_z
|
|
|
|
| 241 |
@tasks.loop(seconds=5) # 每 5 秒檢查一次,視需求調整
|
| 242 |
async def check_updates():
|
| 243 |
global last_cnt, last_to_z
|
| 244 |
+
channel1 = bot.get_channel(1280013315581542401)
|
| 245 |
+
channel2 = bot.get_channel(855383265724465165)
|
| 246 |
url = 'https://master.ntut.edu.tw/Query/CheckIn.aspx' # 替換成你要爬的網址
|
| 247 |
response = requests.get(url)
|
| 248 |
soup = BeautifulSoup(response.text, 'html.parser')
|
|
|
|
| 262 |
to_z += 1
|
| 263 |
|
| 264 |
# 檢查是否有變動
|
| 265 |
+
await channel1.send(f'debug: 🎓 更新通知:目前完成報到人數為 {cnt},備取備取剩下 {to_z} 人。')
|
| 266 |
if cnt != last_cnt or to_z != last_to_z:
|
| 267 |
+
await channel2.send(f'🎓 更新通知:目前完成報到人數為 {cnt},備取備取剩下 {to_z} 人。')
|
|
|
|
| 268 |
if(cnt<36 & to_z==0):
|
| 269 |
+
await channel2.send(f' <@825972112409100348>🎓 上岸拉~~~。')
|
| 270 |
|
| 271 |
last_cnt = cnt
|
| 272 |
last_to_z = to_z
|