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)
评论列表
文章目录