chore: initial commit
This commit is contained in:
51
auto_create_session.exp
Executable file
51
auto_create_session.exp
Executable file
@@ -0,0 +1,51 @@
|
||||
#\!/usr/bin/expect -f
|
||||
|
||||
set timeout 60
|
||||
set phone "+66621394851"
|
||||
|
||||
log_user 1
|
||||
|
||||
puts "\n=========================================="
|
||||
puts "Pyrogram Session 自动创建"
|
||||
puts "==========================================\n"
|
||||
|
||||
spawn python3 create_session_correct.py
|
||||
|
||||
# 匹配电话号码输入
|
||||
expect {
|
||||
-re "(Enter phone|phone number)" {
|
||||
puts "\n>>> 自动输入电话号码: $phone"
|
||||
send "$phone\r"
|
||||
exp_continue
|
||||
}
|
||||
-re "(Is .* correct|确认)" {
|
||||
puts "\n>>> 确认电话号码"
|
||||
send "y\r"
|
||||
exp_continue
|
||||
}
|
||||
-re "(code|验证码)" {
|
||||
puts "\n=========================================="
|
||||
puts "Telegram 验证码已发送到您的手机!"
|
||||
puts "=========================================="
|
||||
|
||||
# 交互模式 - 让用户输入验证码
|
||||
interact {
|
||||
-re "\r" {
|
||||
send "\r"
|
||||
}
|
||||
}
|
||||
}
|
||||
"Session*成功" {
|
||||
puts "\n✅ Session 创建成功!"
|
||||
}
|
||||
timeout {
|
||||
puts "\n❌ 超时"
|
||||
exit 1
|
||||
}
|
||||
eof {
|
||||
puts "\n完成"
|
||||
}
|
||||
}
|
||||
|
||||
# 等待结束
|
||||
expect eof
|
||||
Reference in New Issue
Block a user