Git Product home page Git Product logo

pycqbot's Introduction

pycqBot

go-cqhttp python 框架,可以用于快速塔建 bot

issuesforksstarslicense

项目文档不更新的话 请刷新浏览器缓存

项目文档 (移动至 Github Pages): https://fengliufeseliud.github.io/pycqBot/

go-cqhttp

支持 PyPy

可以使用 PyPy3 进行性能提升

pypy3 -m pip install pycqBot
# 改用 PyPy 运行
pypy3 ./main.py

演示

创建指令

from pycqBot import cqHttpApi, cqBot, cqLog
from pycqBot.data import *

cqLog()

def test(command_data, message: Message):
    message.reply("你好!")
 
bot = cqHttpApi().create_bot()
# 创建指令 "#test"
bot.command(test, "test")

bot.start()

cqCode

from pycqBot.cqCode import image, get_cq_code


cq_code = image("https://i.pixiv.cat/img-master/img/2020/03/25/00/00/08/80334602_p0_master1200.jpg")
# 字典 与 cqCode 互转
print(cq_code, "\n\n", get_cq_code(cq_code))

事件处理

from pycqBot import cqHttpApi, cqBot, cqLog
from pycqBot.data import *


cqLog()

class myCqBot(cqBot):
    
    # 防撤回
    def notice_group_recall(self, event: Notice_Event):
        message = self.cqapi.get_msg(event.data["message_id"])["data"]
        self.cqapi.send_group_msg(message["group_id"], "有一条消息无了 群友还没看清楚呢! %s:%s" % ( 
            message["sender"]["nickname"],
            message["message"]
        ))

bot = myCqBot(cqHttpApi()).start()

pycqbot's People

Contributors

fengliufeseliud avatar dupeiran001 avatar lhlyu 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.