Install simple QQ robot on mobile phone (requires root) Python version

Source: Internet
Author: User

The simplest QQ robot, without the Android phone can be perfect to set up a QQ robot 24 hours online. Implement auto-reply function, answer question and so on. For example: you: Hello robot: Hello, I am QQ robot. You can also set the corresponding reply! There are a lot of features you can write with Python code, very simple! (From Network Collection)

Android version 5.0 or higher

Install the Environment first:

Android phones need to be installed:

App:termux

  Address: Baidu A direct installation can be official website: https://termux.com/

  App:es File Browser

  Address: Baidu a bit directly installed can,

and set it up a bit. Open settings, display settings, show hidden files tick

Get root permission: Automatically pops up with direct point consent. If not, you can select the root toolbox from the top left corner of three bars (menu). Then go to the licensed app's software and click Agree or you can

To configure the Python environment:

  Open Termux, first update the software and required components

APT Update

Apt Upgrade (will let you enter a ' Y ' consent)

Pip Install--upgrade pip

Install the Python main program and the necessary modules:

Apt Install python python-dev python2 Python2-dev (will let you enter a ' Y ' consent)

Install Qqbot, this project GitHub address: Https://github.com/pandolia/qqbot have the ability to read some documents, write better features.

  Pip Install Qqbot

Modify the next Qqbot file, or you will run an error! method is to copy a piece of code to a file

Open the menu under the root directory data\data\com.termux\files\usr\lib\python3.6\site-packages\tzlocal\ folder with the ES file browser unix.py Click Open with text, Select the ES text editor to find the 50th line of blank lines (the previous line is return, the next line is # Now) click on the top of the edit, put:

  

If Os.path.exists ('/system/bin/getprop '):        import subprocess        Androidtz = subprocess.check_output ([' Getprop ' , ' Persist.sys.timezone ']). Strip (). Decode ()        return Pytz.timezone (ANDROIDTZ)
  Copy in, if and upper if alignment, bottom three lines and return alignment is OK. Click Save in the upper-right corner (may not line up, so the display has two lines)

  

Now that the environment is installed, the reply function is implemented below.

Create a PY file, open it, and write it. What you don't want to write can be copied directly.

  Touch a.py

  Open the menu with the Es file browser The root of the Data\data\com.termux\files\home\ folder created under the a.py also opened with text, and then put:

From Qqbot import Qqbotslot as Qqbotslot, RunBot

@qqbotslot

def onqqmessage (bot, contact, member, content):

if content = = '-hello ':

Bot. SendTo (Contact, ' Hello, I'm a QQ robot ')

if content = = '-stop ':

Bot. SendTo (Contact, ' QQ robot closed ')

Bot. Stop ()

if content = = ' Hello ':

Bot. SendTo (Contact, ' Hello, I'm a QQ robot ')

If ' @ME ' in content:

Bot. SendTo (Contact, ' Adrian, what am I doing! ‘)

if __name__ = = ' __main__ ':

RunBot ()

Copy it in, click Save to do it. Note the format

inside the content is the QQ group other people send the message, if content = = '-hello ': If the group message someone sent -hello, then run Bot. SendTo (Contact, ' Hello, I am a QQ robot '), meaning to reply ' Hello, I am a QQ robot '. This can be added a few more, you can also modify their own. It can also be changed into a dictionary dict format, so it is more convenient to have the Python Foundation! or write a function like someone else #study # space a space B then add a dictionary key is a B is value, saved in the dictionary. Someone else sends a direct reply B so that completes the learning function.

Other features have Python-based writing on their own, multiple open qqbot development documentation. It is good to write more, more perfect Android robot, for the time being so called!

Open QQ Robot:

  in the Termux input Python3 a.py can also run, and then there will be a QR code login, the phone will not eject, but save to root directory Data\data\com.termux\files\home\.qqbot-tmp\ folder, you can use QQ to scan the surface, allow the landing of smart QQ can be.

Of course, if you read the development document, Qqbot document, you can change to the mailbox mode to get the QR code. There are other modes.

Next Login directly in the Termux input qqbot-q QQ number directly can be landed, two-dimensional code landing has a deadline, if expired. Re-scan to login

These are some of the knowledge I collect in the network, and I feel the big boys ' tutorials. Patchwork into a simple QQ robot to play. 24-hour Android phone online

Install simple QQ robot on mobile phone (requires root) Python version

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.