Skip to content

corgiclub/corgiNSFW_flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

机器人的flask重构版本

示例代码

from flask import Flask, request, make_response
from httpapi.HTTPSDK import *

# 配置路由,在插件提交返回中配置地址(如本例 http://127.0.0.1:5000)
# Create your views here.

app = Flask(__name__)


@app.route('/', methods=['GET', 'POST'])
def index():
    req = request.get_data()
    sdk = HTTPSDK.httpGet(req)
    print(sdk.getMsg())

    sdk.sendPrivdteMsg(sdk.getMsg().QQ, '你发送了这样的消息:' + sdk.getMsg().Msg)
    sdk.getLoginQQ()

    # 回调演示,提交返回获取群列表、登录QQ等
    if sdk.isCallback() and sdk.getMsg().Type == HTTPSDK.TYPE_GET_LOGIN_QQ:
        print('Login QQ:' + str(sdk.getLoginQQ()))

    return make_response(sdk.toJsonString())


if __name__ == '__main__':
    app.run()

项目结构

┌corgiNSFW_flask
├── static  
│   ├── assets  
│   └── todos.js
├── templates
│   └── todo.html
└── tori.py

corgiNSFW_flask/
    application/         应用扩展
    dog_img/         狗群友聊天图片存储位置
    img/         图片存储位置
    migrations/         数据库迁移文件
    pixivBot/         bot文件夹
    pixivpy3/         爬p站的库
    settings/         配置文件
    -----------------
    app.py         主程序
    corpus.py         语料库

使用方法

装好该装的依赖

flask
flask-sqlalchemy
requests
ntlk

然后运行 app.py

详细命令见flask文档

机器人指令介绍:
http://bot.corgiclub.tk

更新中...

Releases

No releases published

Packages

No packages published