ChieriBot,词云API版,用于统计群友说过的怪话

Overview

wordCloud_API

词云API版,用于统计群友说过的怪话,基于wordCloud

消息储存在mysql数据库中.数据表结构见table.sql

为啥要做成API:这玩意太吃性能了,如果和Bot放在同一个服务器,可能会影响到bot的正常运行

你服务器性能够用的话就当我在放屁

依赖包

pip install jieba
pip install wordcloud
pip install flask
pip install pymysql
  • wordcloud依赖:Pillownumpymatplotlib

部署

  • 先记录信息到数据库中

  • settings.py中填写对应信息

启动服务

  • Windows
python apprun.py
  • Linux :
调试: python apprun.py
运行: nohup python -u apprun.py > wc.log 2>&1 &

调用方式 - 数据库

由于直接返回图片可能会超时,故采用轮询的方式调用

  • 访问http://example.com/wordcloud?id=群号&name=群名
你可能会得到以下结果中的一个:
图片生成中:

此时你应该继续访问相同的地址,直到stat参数值为200500时停止

{
    "file": "",
    "msg": "building",
    "stat": 202
}
调用成功:

访问file内的网址,不出意外的话,你将可以得到一张生成完毕的图片

{
    "file": "http://example.com/getwcimg?id=549090812",
    "msg": "下次缓存刷新时间:28659秒",
    "stat": 200
}
调用失败:

msg将会提示发生错误的原因

{
    "file": "",
    "msg": "ProgrammingError(1146, \"Table 'qqmsglog.999' doesn't exist\") 下次缓存刷新时间:58秒",
    "stat": 500
}

调用方式 - Json

  • 访问POST - http://example.com/jsoncloud?key=(你的key)&bg=(bg文件名)

  • bg文件在Images文件夹内,png格式,请求的时候不需要带.png后缀名

  • Body内填入json Connect-Type:application/json

[{"_id":"词1","value":出现次数},{"_id":"词2","value":出现次数}, ... ]

请求方式同上

由于直接返回图片可能会超时,故采用轮询的方式调用

你可能会得到以下结果中的一个:
图片生成中:

此时你应该继续访问相同的地址,直到stat参数值为200500时停止

{
    "file": "",
    "msg": "building",
    "stat": 202
}
调用成功:

访问file内的网址,不出意外的话,你将可以得到一张生成完毕的图片

{
    "file": "http://example.com/getwcimg?id=549090812",
    "msg": "下次缓存刷新时间:28659秒",
    "stat": 200
}
调用失败:

msg将会提示发生错误的原因

{
    "file": "",
    "msg": "ProgrammingError(1146, \"Table 'qqmsglog.999' doesn't exist\") 下次缓存刷新时间:58秒",
    "stat": 500
}

直接调用 - 数据库

你也可以选择不使用API,直接调用

python demo.py 群号 群名

完成后将返回图片路径

生成结果例:

image

Owner
chinosk
awa
chinosk
Framework To Ease Operating with Quantum Computers

QType Framework To Ease Operating with Quantum Computers Concept # define an array of 15 cubits:

Antonio Párraga Navarro 2 Jun 06, 2022
DRF magic links

drf-magic-links Installation pip install drf-magic-links Add URL patterns # urls.py

Dmitry Kalinin 1 Nov 07, 2021
System Information Utility With Python

System-Information-Utility This is a simple utility, for the terminal, which allows you to find out information about your PC. It's very easy to run t

2 Apr 15, 2022
JSEngine is a simple wrapper of Javascript engines.

JSEngine This is a simple wrapper of Javascript engines, it wraps the Javascript interpreter for Python use. There are two ways to call interpreters,

11 Dec 18, 2022
This repository contains all the data analytics projects that I've worked on in python.

93_Python_Data_Analytics_Projects This repository contains all the data analytics projects that I've worked on in python. No. Name 01 001_Cervical_Can

Milaan Parmar / Милан пармар / _米兰 帕尔马 267 Jan 06, 2023
Python implementation of an automatic parallel parking system in a virtual environment, including path planning, path tracking, and parallel parking

Automatic Parallel Parking: Path Planning, Path Tracking & Control This repository contains a python implementation of an automatic parallel parking s

134 Jan 09, 2023
An end-to-end Python-based Infrastructure as Code framework for network automation and orchestration.

Nectl An end-to-end Python-based Infrastructure as Code framework for network automation and orchestration. Features Data modelling and validation. Da

Adam Kirchberger 15 Oct 14, 2022
🌌 Economics Observatory Visualisation Repository

Economics Observatory Visualisation Repository Website | Visualisations | Data | Here you will find all the data visualisations and infographics attac

Economics Observatory 3 Dec 14, 2022
Xbox-Flood is for flood anything

Intruduction Installation Usage Installing Python 3 Wiki Getting Started Creating a Key Intruduction Xbox-Flood is for flooding messages (invitations

kayake 4 Feb 18, 2022
Nfog - Scriptable Database-Driven NFO Generator for Movies and TV

nfog Scriptable Database-Driven NFO Generator for Movies and TV. Installation pi

6 Oct 08, 2022
A reference implementation for processing the content.log files found at opendata.dwd.de/weather

A reference implementation for processing the content.log files found at opendata.dwd.de/weather.

Deutscher Wetterdienst (DWD) 6 Nov 26, 2022
poetry2nix turns Poetry projects into Nix derivations without the need to actually write Nix expressions

poetry2nix poetry2nix turns Poetry projects into Nix derivations without the need to actually write Nix expressions. It does so by parsing pyproject.t

Nix community projects 405 Dec 29, 2022
Trusted sessions for falcon using itsdangerous.

Falcon signed sessions This project allows you to easily add trusted cookies to falcon, it works by storing a signed cookie in the client's browser us

Ward 1 Feb 08, 2022
An open source server for Super Mario Bros. 35

SMB35 A custom server for Super Mario Bros. 35 This server is highly experimental. Do not expect it to work without flaws.

Yannik Marchand 162 Dec 07, 2022
免杀shellcode加载器

bypassAV 条件触发式远控 VT 5/70 免杀国内杀软及defender、卡巴斯基等主流杀软 原理 https://pureqh.top/?p=5412 use 将shellcode填至go_shellcode_encode.py生成混淆后的base64 payload 然后将生成的payl

405 Dec 14, 2022
A Python 3 client for the beanstalkd work queue

Greenstalk Greenstalk is a small and unopinionated Python client library for communicating with the beanstalkd work queue. The API provided mostly map

Justin Mayhew 67 Dec 08, 2022
NFT generator for Solana!

Solseum NFT Generator for Solana! Check this guide here! Creating your randomized uniques NFTs, getting rarity information and displaying it on a webp

Solseum™ VR NFTs 145 Dec 30, 2022
addons to the turtle package that help you drew stuff more quickly

TurtlePlus addons to the turtle package that help you drew stuff more quickly --------------

1 Nov 18, 2021
A program made in PYTHON🐍 that automatically performs data insertions into a POSTGRES database 🐘 , using as base a .CSV file 📁 , useful in mass data insertions

A program made in PYTHON🐍 that automatically performs data insertions into a POSTGRES database 🐘 , using as base a .CSV file 📁 , useful in mass data insertions.

Davi Galdino 1 Oct 17, 2022
A collection of online resources to help you on your Tech journey.

Everything Tech Resources & Projects About The Project Coming from an engineering background and looking to up skill yourself on a new field can be di

Mohamed A 396 Dec 31, 2022