Develop a QQ robot with a few lines of Python code! Small white can also quickly get started case

Source: Internet
Author: User

This article teaches you how to use Python to realize the QQ robot, if there is a lack of welcome in the comments Party pointed out!

Simple Introduction

Installation method

Can be used in Python versions, installed with PIP:

pip install qqbot

How to use

First, start Qqbot

Second, Operation Qqbot

After Qqbot is started, the following command is currently available in another console window using the QQ command to operate the Qqbot:

The list command provides powerful contact query capabilities, such as:

Such as:

QQ List Group Robot test

For example:

To realize our own QQ robot

To achieve our own QQ robot super simple, we just register a message response function. Code Demonstration:

If you load sample.py as a plugin, the contents of this file can be simplified into:

Interfaces for Qqbot objects

(1) bot. List (Tinfo, [Cinfo])--[Contact0, Contact1, ...,]/[]/none

Example:

The first parameter of the List interface Tinfo can also be a Qcontact object that is equal to ' group '/' discuss ', at which point a list of members of that group/discussion group is returned, such as the following second and third sentences return the member list of group "class 456" and the name of the group The member list for "Jack":

Note that the third sentence is not allowed to be bot. The format of List (g, card= ' Jack ').

The internal execution order of the List interface:

The List interface returns the meaning of the value:

2, Bot. SendTo (Contact, content)--' Send message to XX '/' ERROR: ... '

(3) bot. Groupxxx (group, membs[, Arg])--[' success: ... ', ' success: ... ', ' ERROR: ... ']

(1) bot. List (Tinfo, [Cinfo])--[Contact0, Contact1, ...,]/[]/none

Example:

Note that the third sentence above is not allowed to be bot. The format of List (g, card= ' Jack ').

The internal execution order of the List interface:

The List interface returns the meaning of the value:

(2) bot. SendTo (Contact, content)--' Send message to XX '/' ERROR: ... '

(3) bot. Groupxxx (group, membs[, Arg])--[' success: ... ', ' success: ... ', ' ERROR: ... ']

Register callback functions, notifications by others @, custom Scheduled Tasks

Registering callback Functions

Custom timed Tasks

From 2.1.13 onwards, Qqbot provides a powerful function decorator-qqbotsched to customize timed tasks, sample code:

QR Code Manager, qqbot Configuration and command line parameters

Two-dimensional code display mode

How to use the configuration file

Configuration of the mailbox mode (Mailaccount and Mailauthcode)

Configuration of server mode (Httpserverip and Httpserverport)

QQ Number of automatic login (QQ)

Automatic restart after drop (restartonoffline)

Intermittent time for Contact List update (fetchinterval)

Contact List get finished before starting (Startafterfetch)

Qqbot-term Server port number (Termserverport)

Such as:

Text mode display two-dimensional code (CMDQRCODE)

Debug Mode (Debug)

If the debug key is set to True, debugging information is printed during the run.

List of contacts that need to be monitored (monitortables)

Configuration of plugins (Pluginpath and plugins)

command-line parameters and precedence of configuration

Where: The root configuration is fixed, the user cannot modify; The default configuration and user configuration can be modified by the user in the v2.1.conf file, and finally, the configuration can be entered in the command line arguments.

SMARTQQ Agreement Support and limitations

There is no workaround for the following issues due to the limitations of the SMARTQQ agreement

Resources

Private messages Small 01 can be picked up mystery gift package Oh!

Develop a QQ robot with a few lines of Python code! Small white can also quickly get started case

Related Article

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.