예제 #1
0
def main():
    qq_id = '136314998'
    group_name = '浙江大道-技术部'
    running_job_dict = {}

    bot.Login(['-q', qq_id])
    group = find_group(group_name)
    if not group:
        print('找不到群' + group_name)
        quit()

    while True:
        builds = jenkins_server.get_running_builds()
        # builds = eval("[{'executor': 0, 'name': 'ci-gt-common-timer-dev', 'node': '(master)', 'number': 36, 'url': 'http://jenkins.great-tao.com:8080/job/ci-gt-common-timer-dev/36/'}]")
        builds_dict = {b['name']: b for b in builds}

        created_builds_dict = {
            k: v
            for k, v in builds_dict.items() if k not in running_job_dict
        }
        notify_created(group, created_builds_dict.values())

        running_job_dict.update(created_builds_dict)

        finished_builds_dict = {
            k: v
            for k, v in running_job_dict.items() if k not in builds_dict
        }
        notify_finished(group, finished_builds_dict.values())

        for k, v in finished_builds_dict.items():
            del running_job_dict[k]

        time.sleep(5)
예제 #2
0
def QQBotTest():
    from qqbot import _bot as bot
    qqID = '761282619'  # QQ号
    group_name = 'hxr粉丝群'  # 监听的群s
    bot.Login(['-q', qqID])
    group = bot.List('group', group_name)[0]
    bot.SendTo(group, '测试一下Bot')
예제 #3
0
    def _startup(self,cond):

        # --bench .cache    临时目录在哪里?
        # --cmdQrcode       使用Console的二维码
        # --pluginPath      插件放在哪个目录

        if not self.conf.debug:
            logger.debug("QQ启动生产模式")
            args = "--bench .cache/qbot/ --mailAccount [email protected] --mailAuthCode sxlxhrgeqvzoiaba --pluginPath qbot/plugs --plugins message_processor".split(" ")
        else:
            logger.debug("QQ启动调试模式,QQ号:%s",self.conf.debug_qq)
            __arg = "--bench .cache/qbot/ --debug --cmdQrcode -q " + self.conf.debug_qq + " --pluginPath qbot/plugs --plugins message_processor"
            args = __arg.split(" ")
        logger.info("启动bot.Login登录,args:%s",args)
        # bot.rasa_server = rasa_server #bot这个实例身上给生生安上了一个rasa_server的实例

        cond.acquire()
        bot.Login(args)
        cond.notify()
        cond.release()

        logger.debug("进入bot.Run 死循环等待中...")
        logging.getLogger("Utf8Logger").setLevel(logging.WARNING)#去掉QQ的debug日志
        bot.Run()
        '''
예제 #4
0
def SendMessage(content, member=None):
    # from * import * # 消息过滤
    try:
        from qqbot import _bot as bot
        bot.Login(['-q', '549537094'])  # change
    except BaseException:
        SendEmail('SendMessage', BaseException)
        # 日志记录
        return 0

    try:
        from time import sleep
        if member:
            for group in member:
                message = bot.SendTo(group, content)
                if '失败' in message:
                    pass  # 日志记录
                sleep(0.5)
        else:
            for group in bot.List('group'):
                message = bot.SendTo(group, content)
                if '失败' in message:
                    pass  # 日志记录
                sleep(0.5)
            # 日志记录
    except Exception as e:
        pass
예제 #5
0
 def send(self, qqNum, sendObj):
     """
     发送微语\n
     args:\n
         qqNum:发送者QQ号码
         sendObj:发送对象
     """
     if not isinstance(sendObj, SendObj):
         raise TypeError('sendObj should be SendObj Type,not ' +
                         type(sendObj))
     bot.Login(['-q', '%s' % qqNum])
     mes = self.get_content()
     for bu in sendObj.buddy:
         bl = bot.List('buddy', str(bu))
         if bl:
             b = bl[0]
             bot.SendTo(b, mes)
     for gr in sendObj.group:
         bl = bot.List('group', str(gr))
         if bl:
             b = bl[0]
             bot.SendTo(b, mes)
     for dis in sendObj.discuss:
         bl = bot.List('discuss', str(dis))
         if bl:
             b = bl[0]
             bot.SendTo(b, mes)
예제 #6
0
 def Update(self, update=False):
     if (update):
         bot.Login([
             '-q', self.qq_num_sender, '-ip', self.ip, '-hp', self.port,
             '--daemon', '-r'
         ])
         bot.Update('buddy')
         bot.Update('group')
         return "update successfully!"
예제 #7
0
def execute_v2(qqbot_port, qqbot_num, qqbot_mailauth):
    if not os.path.exists(QRCODE_PATH + qqbot_port):
        os.system('mkdir ' + QRCODE_PATH + qqbot_port)
    bot.Login(['-p', qqbot_port, '-b', QRCODE_PATH+qqbot_port, \
            '-r', '-q', qqbot_num, \
            '-m', qqbot_num+'@qq.com', '-mc', qqbot_mailauth, \
            '-dm'])
    bot.Plug('receiveQQGroupMessage')
    bot.Run()
예제 #8
0
def main():
    init()
    #
    # 登录
    bot.Login(['-r', '-q', '1821367759'])

    # 插件
    bot.Plug("plugin")
    # 主循环
    bot.Run()
    return
예제 #9
0
파일: getgroup.py 프로젝트: zhhhzhang/xnr1
def getgroup():
    result = {}
    try:
        groups = bot.List('group')
    except:
        bot.Login()
        groups = bot.List('group')
    if groups != [] and groups != 'None':
        for group in groups:
            group_name = group.name
            group_number = group.qq
            result[group_number] = group_name
    return result
예제 #10
0
 def Notice(self, nickname='jack', content='Hello World'):
     try:
         bot.Login([
             '-q', self.qq_num_sender, '-ip', self.ip, '-hp', self.port,
             '--daemon', '-r'
         ])
         nickname = 'jack' if nickname == '' else nickname
         content = 'Hello World' if content == '' else content
         bl = bot.List('buddy', nickname)
         if bl:
             b = bl[0]
             bot.SendTo(b, content)
             return "Notice '{ct}' sent to {nickname} successfully!".format(
                 ct=content, nickname=nickname)
         return 'Get buddy error!'
     except:
         return 'Notice Error!'
예제 #11
0
파일: qqKia.py 프로젝트: Tr0py/QQbot_Kia
#coding:utf-8

import Kia
from qqbot import _bot as bot
bot.Login(['-q', '2352341722'])
s = bot.List('buddy')
print(s[0])
s = bot.List('group', '小开测试群')[0]
print(s, type(s), s.qq, s.name, s.uin, s.mark)
예제 #12
0
파일: qq.py 프로젝트: wdxsbmc/HAchina
 def run(self):
     bot.Login(['-u', str(self.qq)])
     bot.Run()
예제 #13
0
from qqbot import _bot as bot

bot.Login(['-q', '3391775316'])

bot.Update('buddy')

g = bot.List('buddy', 'imp')  # 直接输入qq号不行
g = g[0]
print([g, type(g), g.qq, g.name, g.uin, g.mark])
bot.SendTo(g, 'hello')
예제 #14
0
파일: qqbot.py 프로젝트: b4158813/Gadgets
from qqbot import _bot as bot

bot.Login(['-q', '814295903'])
예제 #15
0
def execute():
    bot.Login()
    bot.Plug('receiveQQGroupMessage')
    bot.Run()
예제 #16
0
import pandas as pd
import datetime
from qqbot import _bot as bot


def contract(exchange):
    data = pd.read_csv(exchange + today1 + "InstrumentInfo.csv",
                       encoding='gbk')
    contractL = []
    for indexs in data.index:
        boardingdate = data.loc[indexs].values[11]
        if str(boardingdate) == nextdate1:
            contractL.append(data.loc[indexs].values[1])
    str1 = ''.join(contractL)
    print u'【' + exchange + u'新合约】 ' + str1 + ''
    bot.SendTo(bl[0], u'【' + exchange + u'新合约】 ' + str1 + '')


if __name__ == '__main__':
    ONE_DAY = datetime.timedelta(days=1)
    today = datetime.date.today()
    nextdate = datetime.date.today() + ONE_DAY
    nextdate1 = datetime.datetime.strftime(nextdate, '%Y%m%d')
    today1 = datetime.datetime.strftime(today, '%Y%m%d')
    print "Next business day:" + nextdate1
    L = ['SHFE', 'INE']
    bot.Login(['-q', ''])
    bl = bot.List('buddy', u'')
    for item in L:
        contract(item)
예제 #17
0
# 指定启动参数。详细请参见 qqbot 命令的帮助 (qqbot --help)。
args = [
    # 用户名
    '--user',
    'username',

    #  QQ 号码
    '--qq',
    '12345678',

    # 插件目录
    '--pluginPath',
    '/my/plugin/path',

    # 启动时自动加载的插件
    '--plugins',
    'plugin1,plugin2,plugin3',

    # 启动方式:慢启动(获取全部联系人之后再启动)
    '--startAfterFetch',

    # 打印调试信息
    '--debug',
]

if __name__ == "__main__":
    # 注意:此时重启功能无法使用
    from qqbot import _bot as bot
    bot.Login(args)
    bot.Run()
예제 #18
0
        if moduleName not in self.plugins:
            result = '警告:试图卸载未安装的插件 %s' % moduleName
            WARN(result)
            return result
        else:
            module = self.plugins[moduleName]
            self.unplug(moduleName)
            if hasattr(module, 'onUnplug'):
                _call(module.onUnplug, self)
            result = '成功:卸载插件 %s' % moduleName
            INFO(result)
            return result

    def Plugins(self):
        return list(self.plugins.keys())


_bot = QQBot()
QQBot._bot = _bot
QQBotSlot = _bot.AddSlot
QQBotSched = _bot.AddSched
QQBot.__init__ = None

if __name__ == '__main__':
    from qqbot import _bot as bot
    bot.Login(['-q', '2850450055'])
    gl = bot.List('buddy')
    print(gl)
    # ml = bot.List(gl[0])
    # m = ml[0]
예제 #19
0
        return self.member_live_msg_ids

    def parse_memberReviewLive_msg(self, response, limit=5):
        message = ""
        if "reviewList" in response["content"].keys():
            DEBUG("获得录播列表")
            live_list = response["content"]["reviewList"]
            live_list = live_list[:limit]
            message += "小偶像的录播:\n\n"
            for live_info in live_list:
                idol_name = live_info["title"]
                subtitle = live_info["subTitle"]
                streamPath = live_info["streamPath"]
                startTime = convert_timestamp_to_timestr(
                    live_info["startTime"])
                live_id = live_info["liveId"]
                member_id = live_info["memberId"]
                message += ('%s : %s [%s]\n %s\n\n' %
                            (idol_name, subtitle, startTime, streamPath))
            bot.SendTo(bot.List('group', self.group_id)[0], message)


if __name__ == "__main__":
    bot.Login(['-q', '2754757912'])
    handler = Pocket48Handler()
    handler.login()
    # res = handler.get_roomChat_msg(room_id, limit = 1)
    # handler.parse_roomChat_msg(res, room_id)
    res = handler.get_memberLive_msg(limit=20)
    handler.parse_memberLive_msg(res)
예제 #20
0
import requests
from qqbot import _bot as bot
from qqbot import QQBotSlot as qqbotslot, RunBot
bot.Login(['-q', '1431077852'])

KEY = 'f9237861bc284488b37b4727b2be18f9'  # 这个是图灵机器人,建议自己注册一个

# 向api发送请求,不要改动
def get_response(msg):
    apiUrl = 'http://www.tuling123.com/openapi/api'
    data = {
        'key': KEY,
        'info': msg,
        'userid': 'pth-robot',
    }
    try:
        r = requests.post(apiUrl, data=data).json()
        return r.get('text')
    except:
        return



# @itchat.msg_register(itchat.content.TEXT)
def tuling_reply(bot, contact, member, content):
    # 为了保证在图灵Key出现问题的时候仍旧可以回复,这里设置一个默认回复
    # print(msg["Text"][0:4])
    print(content)
    b1 = bot.List('buddy','任')
    b = b1[0]
    reply = get_response(content)
예제 #21
0
def main():
    # 参数 -q <QQ号> 可以指定使用之前登录过的账号
    argv = ['-pp', FILE_DIR, '-pl', 'from_smartqq'] + sys.argv[1:]
    bot.Login(argv)
    bot.Run()
예제 #22
0
from qqbot import _bot as bot
import requests
from lxml import etree
import time
bot.Login(['-q', '2694010411'])  #登陆一下
sent_list = [
    '1120897575', '411774285', '1961346989', '1466648053', '2621564050',
    '1244979861', '378853264'
]


def film_name(a):
    s_words = etree.HTML(a)
    for num_list in range(25):
        num_list += 1
        cn_name = s_words.xpath('//*[@id="content"]/div/div[1]/ol/li[' +
                                str(num_list) +
                                ']/div/div[2]/div[1]/a/span[1]/text()')  # 电影名
        words = s_words.xpath('//*[@id="content"]/div/div[1]/ol/li[' +
                              str(num_list) +
                              ']/div/div[2]/div[2]/p[2]/span/text()')  # 一句话
        str_name_not = str(cn_name)  #同下
        str_name_yes = str_name_not[2:-2]  #参考下面
        str_words_not = str(words)  #转换类型
        str_words_yes = str_words_not[2:-2]  #去掉多余的东西
        str_sent = str_name_yes + '——' + str_words_yes  #拼接字符串
        for qqfriend in sent_list:
            bl = bot.List('buddy', qqfriend)  #发送给谁
            if bl:  #不知道在这里判断了什么 (-‸ლ)无语
                b = bl[0]
                bot.SendTo(b, str_sent)
예제 #23
0
 def login(self, qq_number):
     bot.Login(['-u', qq_number])
예제 #24
0
from qqbot import _bot as bot


def sendMsgToBuddy(msg, buddyList, bot):
    pass


def main(bot):
    buddyMsg = '你好'
    with open('./qq.txt', 'r') as fr:
        qqBuddy = fr.readline().strip()

    qqBuddyList = qqBuddy.split(',')
    sendMsgToBuddy(buddyMsg, qqBuddyList, bot)


if __name__ == '__main__':
    bot.Login(['-q', '1511325099'])
    main(bot)
예제 #25
0
    with open('weibo.txt', 'r') as fr:
        qqGroup = fr.readline().strip()
        qqBuddy = fr.readline().strip()
        wchat = fr.readline().strip()
        wroomchat = fr.readline().strip()
    qqGroupList = qqGroup.split(',')
    qqBuddyList = qqBuddy.split(',')
    wChatList = wchat.split(',')
    wRoomList = wroomchat.split(',')
    qqinit = 1
    #print(' cnt :' + str(len(qqGroupList)) + ' cnt2:' + str(len(qqBuddyList)))
    if (len(qqGroupList) > 0
            and qqGroupList[0] != '') or (len(qqBuddyList) > 0
                                          and qqBuddyList[0] != ''):
        zh = input('请输入QQ号:')
        bot.Login(['-q', zh])
        qqinit = 2

    wchatinit = 1
    if (len(wChatList) > 0 and wChatList[0] != '') or (len(wRoomList) > 0
                                                       and wRoomList[0] != ''):
        itchat.auto_login(hotReload=True)  # 首次扫描登录后后续自动登录
        wchatinit = 2

    laststring = ''  # 临时内存内容比较
    while True:
        print("正在爬取最新一条微博...")
        isnew, laststring = get_newweibo(id, laststring)
        if isnew == True:
            print('监控到新消息')
            if qqinit == 2:
예제 #26
0
    try:
        # step1:调用接口,获取数据。
        result = requests.get(QQQUANAPI, params={}, timeout=1)
        # 格式化数据
        # result = result.encode("UTF-8")
        date = json.loads(result.text.encode("UTF-8"))
        # step2:取出数据数组结果格式化代码,并取出想要的数组。
        goods = date['data']['result']
        return goods
        # 写入到数据库中
    except Exception:
        print('网络错误处理')


def main(bot, inc=60):
    #获取数组数据
    # goods = sendQQQuanApi()
    # #将数组传递给 sendQQquanMessageToQQ
    # sendQQquanMessageToQQ(goods)

    # print(result.text)
    # enter四个参数分别为:间隔事件、优先级(用于同时间到达的两个事件同时执行时定序)、被调用触发的函数,
    # 给该触发函数的参数(tuple形式)
    schedule.enter(0, 0, setTaskTime, (inc, ))
    schedule.run()


if __name__ == '__main__':
    bot.Login(['-q', '757534571'])
    main(bot, 10)
예제 #27
0
def log_in(user_qq, msg_queue):
    global __msg_queue
    __msg_queue = msg_queue
    bot.Login(['-q', user_qq])
예제 #28
0
파일: QQ.py 프로젝트: ttp55/LearnPy
# @Time : 2019/12/23 15:37
# @Author : WZG
# --coding:utf-8--

from qqbot import _bot as bot

bot.Login(['-q', '378460296'])

group = bot.List('group', 'b.k')
예제 #29
0
    def Unplug(self, moduleName):
        if moduleName not in self.plugins:
            result = '警告:试图卸载未安装的插件 %s' % moduleName
            WARN(result)
            return result
        else:
            module = self.plugins[moduleName]
            self.unplug(moduleName)
            if hasattr(module, 'onUnplug'):
                _call(module.onUnplug, self)
            result = '成功:卸载插件 %s' % moduleName
            INFO(result)
            return result

    def Plugins(self):
        return list(self.plugins.keys())


_bot = QQBot()
QQBot._bot = _bot
QQBotSlot = _bot.AddSlot
QQBotSched = _bot.AddSched
QQBot.__init__ = None

if __name__ == '__main__':
    from qqbot import _bot as bot
    bot.Login()
    gl = bot.List('group')
    ml = bot.List(gl[0])
    m = ml[0]
예제 #30
0
from qqbot import _bot as bot
import time
import csv
import requests
import json

#这里改为你的q号?
bot.Login(['-q', '2143738142'])

#这里改为你的群名
mainGroup = bot.List('group', 'TeeWorlds中国社区')[0]  #2960233702
chatGroup = bot.List('group', 'Teeworlds闲聊群')[0]  #1516349281
isChatGroup = False

#for test
#mainGroup = bot.List('group')[1]

replyFile = "autoReply.txt"
replyDict = {}
with open(replyFile, 'r') as f:
    spamreader = csv.reader(f, delimiter=',')
    for row in spamreader:
        if not row:
            continue
        if row[0].startswith('#'):
            print(row)
        else:
            replyDict[row[0]] = row[1]

chatAPI = "http://www.tuling123.com/openapi/api"
requestJson = {