chatbot.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:loveliv 作者: xmcp 项目源码 文件源码
def send_msgs():
    with sqlite3.connect('events.db') as db:
        cur=db.cursor()
        cur.execute('select msgid,content from push_msgs')
        res=cur.fetchall()
        for msgid,content in res:
            if itchat.send_msg(content,toUserName=group_name):
                cur=db.cursor()
                cur.execute('delete from push_msgs where msgid=?',[msgid])
                db.commit()
                print(' -> sent msg:',content)
            else:
                if msgid not in logged_errors:
                    print('!!! send failed:',content)
                    log('error','?????????#%d??%s'%(msgid,content))
                    logged_errors.add(msgid)
            time.sleep(.5)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号