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 random import time from collections import deque from datetime import datetime, timedelta import pytz from apscheduler.schedulers.background import BackgroundScheduler from cqsdk import CQBot, CQAt, RE_CQ_SPECIAL, \ RcvdPrivateMessage, RcvdGroupMessage, \ SendPrivateMessage, SendGroupMessage, \ GroupMemberDecrease, GroupMemberIncrease, \ GroupBan from utils import match, reply qqbot = CQBot(11235) scheduler = BackgroundScheduler( timezone='Asia/Tokyo', job_defaults={'misfire_grace_time': 60}, ) ################ # Restriction ################ POI_GROUP = '378320628' BANNED_MAX_DURATION = 1440 BANNED_RESET_TIME = timedelta(hours=20) BANNED_RECORDS = {} with open('admin.json', 'r', encoding="utf-8") as f:
#!/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
import json import os import re import traceback from datetime import datetime, timezone, timedelta import requests from apscheduler.schedulers.background import BackgroundScheduler from requests_oauthlib import OAuth1Session import utils from utils import CQ_IMAGE_ROOT, info, error, FileDownloader from cqsdk import CQBot, CQImage, SendGroupMessage, SendPrivateMessage qqbot = CQBot(11235, online=False) scheduler = BackgroundScheduler( timezone='Asia/Tokyo', job_defaults={'misfire_grace_time': 60}, ) with open('twitter.json', 'r') as f: data = json.loads(f.read()) session = OAuth1Session( client_key=data['consumer_key'], client_secret=data['consumer_secret'], resource_owner_key=data['access_token'], resource_owner_secret=data['access_secret'], ) NOTIFY = data['notify']