def run(self): qq_bot = CQBot(CQ_PORT) tg_bot = None global_vars.set_qq_bot(qq_bot) global_vars.set_tg_bot_id(int(TOKEN.split(':')[0])) updater = Updater(TOKEN) job_queue = updater.job_queue tg_bot = updater.bot global_vars.set_tg_bot(tg_bot) # Get the dispatcher to register handlers dp = updater.dispatcher global_vars.set_dp(dp) dp.add_error_handler(error) dp.add_handler(CommandHandler('start', start), group=0) qq_bot.start( ) # start bot before add handler, in order to execute init correctly updater.start_polling(poll_interval=1.0, timeout=200) import plugins # Block until the you presses Ctrl-C or the process receives SIGINT, # SIGTERM or SIGABRT. This should be used most of the time, since # start_polling() is non-blocking and will stop the bot gracefully. updater.idle()
count = len(pic) -1 pic = pic[count]["src"] comments = data[0]["node"]["edge_media_to_comment"]["count"] like = data[0]["node"]["edge_liked_by"]["count"] url = data[0]["node"]["shortcode"] url = 'https://www.instagram.com/p/' + url except Exception as e: insTime = 0 text = '' like = 0 comments =0 pic = '' url = '' return int(insTime),str(text),int(like),int(comments),str(pic),str(url) qqbot = CQBot(11235) qqbot.start() proxy = '127.0.0.1:8118' proxies = { 'http': 'http://' + proxy, 'https': 'https://' + proxy } print('开始获取INS') dataIns = getIns(urlINS) Instext = dataIns[0] Inspicurl = dataIns[1] print(Inspicurl) Insweburl = dataIns[2] insTime = dataIns[0] print('最新INS时间:' + str(insTime))
# import from telepot import telepot from telepot.loop import MessageLoop # import from coolq-sdk from utils import CQ_IMAGE_ROOT, error, reply from cqsdk import CQBot, CQAt, CQImage, RE_CQ_SPECIAL from cqsdk import GroupMemberDecrease, GroupMemberIncrease from cqsdk import RcvdPrivateMessage, RcvdGroupMessage, RcvdDiscussMessage from cqsdk import SendPrivateMessage, SendGroupMessage, SendDiscussMessage # global variables ## QQ bot qq_bot = CQBot(11235) ## Telegram bot tg_bot = telepot.Bot(tg_token) tg_bot_id = int(tg_token.split(':')[0]) ## sticker link mode switches (0 -> disable, 1 -> enable) sticker_link_modes = [0] * len(forward_ids) ## drive mode switches (0 -> disable, 1 -> enable) drive_modes = [0] * len(forward_ids) ## reflect of QQ number and QQ group member name with open('namelist.json', 'r', encoding="utf-8") as f: data = json.loads(f.read()) qq_name_lists = data
#!/usr/bin/env python3 # coding: UTF-8 import json import os import re import traceback from datetime import datetime, timezone, timedelta from xmlrpc.server import SimpleXMLRPCServer import utils from utils import CQ_IMAGE_ROOT, info, error, FileDownloader from cqsdk import CQBot, CQImage, SendGroupMessage, SendPrivateMessage qqbot = CQBot(11235, online=False) with open('twitter.json', 'r') as f: data = json.loads(f.read()) NOTIFY = data['notify'] REQUESTS_OPTIONS_PROXIED = { 'timeout': 60, 'proxies': { 'http': 'socks5://127.0.0.1:1080', 'https': 'socks5://127.0.0.1:1080', } } ################ # Timeline