forked from CoderWanFeng/python-office
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwechat.py
More file actions
60 lines (41 loc) · 1.37 KB
/
wechat.py
File metadata and controls
60 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: UTF-8 -*-
'''
@作者 :B站/抖音/微博/小红书/公众号,都叫:程序员晚枫,微信:CoderWanFeng
@读者群 :http://www.python4office.cn/wechat-group/
@学习网站 :https://www.python-office.com
@代码日期 :2023/8/22 23:28
'''
"""
🤖10讲Python微信机器人,小白也能学会
https://www.bilibili.com/video/BV1S84y1m7xd/
"""
import PyOfficeRobot
from office.lib.decorator_utils.instruction_url import instruction
# @instruction
def send_message(who: str, message: str):
PyOfficeRobot.chat.send_message(who, message)
# @instruction
def send_message_by_time(who, message, time):
PyOfficeRobot.chat.send_message_by_time(who, message, time)
# @instruction
def chat_by_keywords(who, keywords):
PyOfficeRobot.chat.chat_by_keywords(who, keywords)
# @instruction
def send_file(who, file):
PyOfficeRobot.file.send_file(who, file)
def group_send():
PyOfficeRobot.group.send()
# 保存指定人的消息
# BY:盖飞
# @instruction
def receive_message(who='文件传输助手', txt='userMessage.txt', output_path='./'):
PyOfficeRobot.chat.receive_message(who, txt, output_path)
# @instruction
def chat_robot(who='程序员晚枫'):
"""
智能聊天
Args:
who: 指定聊天对象,可以是备注名称。不支持特殊字符。
Returns:
"""
PyOfficeRobot.chat.chat_robot(who)