fwefwf
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
telegram/sign.db
BIN
telegram/sign.db
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
import time
|
||||
import asyncio
|
||||
import datetime
|
||||
|
||||
from telethon import TelegramClient
|
||||
@@ -41,12 +42,11 @@ class WeexTransaction:
|
||||
|
||||
self.session = requests.Session() # 接口请求对象
|
||||
|
||||
async def send_dingtalk_message(self, message_content):
|
||||
|
||||
async def to_do_tg(self, message_content):
|
||||
# ========== 配置区 ==========
|
||||
API_ID = 2040 # 替换成你的 API ID
|
||||
API_HASH = "b18441a1ff607e10a989891a5462e627" # 替换成你的 API HASH
|
||||
SESSION_FILE = "8619211027341" # 登录会话保存文件
|
||||
SESSION_FILE = "../telegram/8619211027341" # 登录会话保存文件
|
||||
# ============================
|
||||
|
||||
PROXY = {
|
||||
@@ -59,12 +59,17 @@ class WeexTransaction:
|
||||
|
||||
try:
|
||||
client = TelegramClient(SESSION_FILE, API_ID, API_HASH, proxy=PROXY)
|
||||
await client.start() # 登录,如果第一次会要求输入手机号和验证码
|
||||
bot = await client.get_entity("ergggreef")
|
||||
await client.send_message(bot, message_content)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def send_dingtalk_message(self, message_content):
|
||||
result = asyncio.run(self.to_do_tg(message_content))
|
||||
return result
|
||||
|
||||
def openBrowser(self, ): # 直接指定ID打开窗口,也可以使用 createBrowser 方法返回的ID
|
||||
|
||||
try:
|
||||
@@ -289,7 +294,7 @@ class WeexTransaction:
|
||||
tab.close()
|
||||
return True if self.cookies else False
|
||||
|
||||
def get_now_time(self):
|
||||
def get_now_time1(self):
|
||||
timestamp = time.time()
|
||||
local_time = time.localtime(timestamp)
|
||||
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S", local_time)
|
||||
@@ -368,7 +373,7 @@ class WeexTransaction:
|
||||
self.pbar.n = current_minute - 30
|
||||
self.pbar.refresh()
|
||||
|
||||
if current_minute not in [0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34, ]: # 判断是否是 新的30分钟了
|
||||
if current_minute not in [0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34]: # 判断是否是 新的30分钟了
|
||||
# if current_minute not in range(60): # 判断是否是 新的30分钟了
|
||||
time.sleep(10)
|
||||
continue
|
||||
@@ -385,8 +390,9 @@ class WeexTransaction:
|
||||
self.kline_1, self.kline_2, self.kline_3 = new_price_datas1[-3:]
|
||||
|
||||
# 判断抓取的数据是否正确
|
||||
if self.get_now_time() == self.kline_3["id"]:
|
||||
if self.get_now_time() == int(self.kline_3["id"]):
|
||||
logger.success("获取最新交易价格成功!!!")
|
||||
self.send_dingtalk_message("获取最新交易价格成功!!!")
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user