Coder Social home page Coder Social logo

wechit's Introduction

WECHIT

- WEChat In Terminal 微信终端版

Alternative WeChat client right in your terminal. Socialize without ever leaving the command line. Send and receive messages, files and images (as ASCII art). Add your own scripts to automate batch sending and broadcasting messages, or just write an AI to socialize for you.

How it works

WeChit controls a hidden Google Chrome instance in the background via Selenium. It punches buttons and fetch data from WeChat for Web and feed it to your terminal. Your input is then automatically sent back for further interactions. Images are available for terminals supporting ANSI colors, and are rendered using custom ASCII-art engine.

Features

Log In from Terminal

Send Text and Images

Multilingual Support

Usage

Dependencies

Mainly tested on macOS 10.13, ChromeDriver 2.41.578706, Python 3.6.5 and Python 2.7.15, but should work on other OS and set-up too. Oher browser drivers (e.g. Safari, Firefox, etc.) may be used in place of ChromeDriver, but is untested and requires modifying source.

Installation

  • Clone this repo and cd into it.
  • Place the chrome driver executable in top-level wechit/ folder.
  • Run python wechit.py to start the client.

Configure (Optional)

  • WeChit use ASCII art with ANSI colors to display images in the terminal. It decides what character and color combinations to use by looking up a pre-generated table stored in colormap.json. This table is somewhat specific to the font being used by the terminal. The table packaged with Wechit is generated based on the Monaco typeface. If you would like to generate a new table tuned to another font, you can run python term_colormeter.py path/to/my/font.ttf to do so.

Custom Scripts

Besides running wechit.py as a commandline app, you can also import it as a python module and write your own script to automate sending messages. For example, use this script to harass your favorite frenemy by sending them the same message 100 times.

import time
import wechit

recipent = "Bob"
message = "I love you"

print("initializing...")
    
# initialize driver
driver = wechit.init_driver()

# wait for page to load
time.sleep(1)

# fetch the qr code
im = wechit.get_qr_code(driver)

# display qr code
print(wechit.print_qr_code(im))

# wait for chat window to load
wechit.wait_for_chat_window(driver)
print("logged in as \""+wechit.get_username(driver)+"\"! loading chats...")

# start conversation with recipent
ret_name = wechit.goto_conversation(driver, recipent)
print("ok. now you're chatting with someone called \"%s\"."%(wechit.render_unicode(wechit.no_emoji(ret_name))))

# send the messages
for i in range(100):
    print("sending message:",message)
    wechit.send_message(driver,message)
    print("sent!")

More examples can be found in ./examples folder. e.g. try python examples/broadcast.py

wechit's People

Contributors

lingdong- avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.