Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing the path for mac book in py #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Coderbunker Contract template - Agora Space.pdf
Binary file not shown.
Binary file added Coderbunker collaboration model with clients.pdf
Binary file not shown.
Binary file added fred.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added introduction.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added itchat.pkl
Binary file not shown.
175 changes: 175 additions & 0 deletions real_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import time, datetime, requests, itchat
from itchat.content import *
import logging
itchat.auto_login()

#############################################################Try using Content = input(msg.text)



#group = itchat.search_chatrooms(bool(name.find(u'Coderbunker')=True)

#group = itchat.search_chatrooms('UserName'.startswith('Coderbunker'))


#group = itchat.search_chatrooms(name=u'Coderbunker')

#group = itchat.search_chatrooms(NickName=u'Coderbunker')



#reply = itchat.send(u'MY LAST HOPING BOT TEST. This is your time:\n{:%Y-%b-%d %H:%M:%S}'.format(datetime.datetime.now()), friend[0]['UserName'])
#print(reply['BaseResponse']['ErrMsg'])

#reply = itchat.send_image('C:\\Users\\user\\Desktop\\CODER BUNKER INTERN\\workspace\\chatbot\\images\\joseph.jpg',friend[0]['UserName'])
#print(reply['BaseResponse']['ErrMsg'])

#reply = itchat.send_file('C:\\Users\\user\\Desktop\\CODER BUNKER INTERN\\workspace\\chatbot\\images\\sunflower.mp3', friend[0]['UserName'])

#reply = itchat.send(u'MY LAST HOPING BOT TEST. This is your time:\n{:%Y-%b-%d %H:%M:%S}'.format(datetime.datetime.now()), group[0]['UserName'])
#print(reply['BaseResponse']['ErrMsg'])

customer = itchat.search_friends(name =u'None')

@itchat.msg_register(itchat.content.TEXT)
def personal_reply(msg):
try:
print(msg.text)
reply_text = ''
if msg.text == '#freelancer':

reply_text ='''
[Bot]Please answer these questions below. Completing these questions will allow us to provide the service quickly 😊 \n\n
1. What are your programming skills and experience? \n
2. What is your availability per week (in hours)? \n
3. What is your current location?'''


elif msg.text == '#client':
reply_text = '[Bot]These are some of the files for your reference! Below is a questionnaire that will speed up the process if completed 😊 \nhttps://forms.gle/8quKU4C1anJtZq6P8'

return reply_text

elif msg.text == '#other':
reply_text = '[Bot]If you tell us your order, we will come to you as soon as possible!'


return reply_text


except:
logging.warning('PM not working? ')





@itchat.msg_register(TEXT,isGroupChat=True)
def auto_reply(msg):
coming_from = msg.get('ActualNickName')
context = msg.text
friend = itchat.search_friends(name=coming_from)
print(f'{coming_from}:{context}')

words = context.split(" ")
file_name = words[0]
receiving_name = words[-1]
print(receiving_name)
# this gives ricky.jpg after @
receiving_friend= itchat.search_friends(name=receiving_name)

if len(words)>1:
#for two word names
receiving_name_two = words[-2] + ' ' + words[-1]
print(receiving_name_two)
receiving_friend_two = itchat.search_friends(name=receiving_name_two)


try:
try:
reply = itchat.send_file(
'/Users/suser/Desktop/store_file/' + msg.text, friend[0]['UserName'])

reply = itchat.send_image('/Users/suser/Desktop/store_file/' + file_name, receiving_friend[0][
'UserName'])

except:
reply = itchat.send_image(
'/Users/suser/Desktop/store_file/' + file_name, receiving_friend_two[0][
'UserName'])

except:
logging.warning('The text received seems to be containing special symbol or unordinary length ')
pass

if context == '#freelancer':
reply = itchat.send_msg(
u'[Bot]Please answer these questions below. Completing these questions will affllow us to provide the service quickly 😊',
friend[0]['UserName'])

reply = itchat.send_msg(
u'[Bot]1. What are your programming skills and experience? \n2.What is your availability per week (in hours)? \n 3.What is your current location? ',
friend[0]['UserName'])


elif context == '#client':
reply = itchat.send_file(
'/Users/suser/Desktop/store_file/Coderbunker collaboration model with clients.pdf',
friend[0]['UserName'])

reply = itchat.send_file(
'/Users/suser/Desktop/store_file/Coderbunker Contract template - Agora Space.pdf',
friend[0]['UserName'])



reply = itchat.send_msg(
u'[Bot]These are some of the files for your reference! Below is a questionnaire that will speed up the process if completed 😊 \n https://forms.gle/8quKU4C1anJtZq6P8',
friend[0]['UserName'])


@itchat.msg_register(FRIENDS)
def add_friend(msg):
print(u'[ Terminal Info ] New Friend Request 新朋友的请求,自动通过验证添加加好友 From: %s' % msg['RecommendInfo']['UserName'])
itchat.add_friend(**msg['Text']) # 该操作会自动将新好友的消息录入,不需要重载通讯录

itchat.send_image(
'/Users/suser/Desktop/store_file/ricky.jpg',
msg['RecommendInfo']['UserName'])

itchat.send_image(
'/Users/suser/Desktop/Desktop/store_file/fred.jpg',
msg['RecommendInfo']['UserName'])

itchat.send_image(
'/Users/suser/Desktop/store_file/introduction.jpg',
msg['RecommendInfo']['UserName'])

itchat.send_image(
'/Users/suser/Desktop/store_file/space.jpg',msg['RecommendInfo']['UserName'])



itchat.send_msg(
u'[Bot]The documents below are for you if you are a client'
, msg['RecommendInfo']['UserName'])

reply = itchat.send_file(
'/Users/suser/Desktop/store_file/Coderbunker collaboration model with clients.pdf',
msg['RecommendInfo']['UserName'])

reply = itchat.send_file(
'/Users/suser/Desktop/store_file/Coderbunker Contract template - Agora Space.pdf',
msg['RecommendInfo']['UserName'])



itchat.send_msg(u'[Bot]Thank you for adding CoderBunker! Will you please tell us if you are here for freelancer, client, or other purposes? \n #freelancer for freelancer #client for client and #other for other 😊'
,msg['RecommendInfo']['UserName'])




itchat.run()


Binary file added ricky.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added space.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.