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
EasyBuild is a software build and installation framework that allows you to manage (scientific) software on High Performance Computing (HPC) systems in an efficient way.

EasyBuild is a software build and installation framework that allows you to manage (scientific) software on High Performance Computing (HPC) systems in an efficient way.

EasyBuild community 87 Dec 27, 2022
Age of Empires II recorded game parsing and summarization in Python 3.

mgz Age of Empires II recorded game parsing and summarization in Python 3. Supported Versions Age of Kings (.mgl) The Conquerors (.mgx) Userpatch 1.4

148 Dec 11, 2022
Python library for parsing Godot scene files

Godot Parser This is a python library for parsing Godot scene (.tscn) and resource (.tres) files. It's intended to make it easier to automate certain

Steven Arcangeli 30 Jan 04, 2023
Search and Find Jobs in Ethiopia

✨ EthioJobs ✨ Search and Find Jobs in Ethiopia Easy start critical warning Use pycharm No vscode No sublime No Vim No nothing when you want to use

Abdimk 12 Nov 09, 2022
Like Docker, but for Squeak. You know, for kids.

Squeaker Like Docker, but for Smalltalk images. You know, for kids. It's a small program that helps in automated derivation of configured Smalltalk im

Tony Garnock-Jones 14 Sep 11, 2022
A collection of resources on neural rendering.

awesome neural rendering A collection of resources on neural rendering. Contributing If you think I have missed out on something (or) have any suggest

1.8k Dec 30, 2022
Covid-19-Trends - A project that me and my friends created as the CSC110 Final Project at UofT

Covid-19-Trends Introduction The COVID-19 pandemic has caused severe financial s

1 Jan 07, 2022
A visidata plugin for parsing f5 ltm/gtm/audit logs

F5 Log Visidata Plugin This plugin supports the default log format for: /var/log/ltm* /var/log/gtm* /var/log/apm* /var/log/audit* It extracts common l

James Deucker 1 Jan 06, 2022
Basic code and description for GoBigger challenge 2021.

GoBigger Challenge 2021 en / 中文 Challenge Description 2021.11.13 We are holding a competition —— Go-Bigger: Multi-Agent Decision Intelligence Challeng

OpenDILab 183 Dec 29, 2022
Team10 backend - A service which accepts a VRM (Vehicle Registration Mark)

GreenShip - API A service which accepts a VRM (Vehicle Registration Mark) and re

3D Hack 1 Jan 21, 2022
A very basic ciphering/deciphering tool

ckrett-python-library This is an useful python library for people who care about privacy, this library is useful to cipher and decipher text using 4 s

SasiVatsal 8 Oct 18, 2022
Project 2 for Microsoft Azure on WUT

azure-proj2 Project 2 for Microsoft Azure on WUT Table of contents Team Tematyka projektu Architektura Opis rozwiązania Demo dzałania The Team Krzyszt

1 Dec 07, 2021
Opendrop - An open Apple AirDrop implementation written in Python

OpenDrop: an Open Source AirDrop Implementation OpenDrop is a command-line tool that allows sharing files between devices directly over Wi-Fi. Its uni

Secure Mobile Networking Lab 7.5k Jan 03, 2023
Chalice - A tool to facilitate Python based lambda deployment

Chalice is a tool to facilitate Python based lambda deployment. This repo contains the output of my basic exploration of this tool.

Csilla Bessenyei 1 Feb 03, 2022
Materials for the Introduction in Python , Linux , Git and Github

This repository contains all the materials of the presentation on the introduction of python, linux, git and Github.

AMMI 3 Aug 28, 2022
My solutions for Advent of Code 2021 🌟🎄

🌟 Advent of Code 2021 🎄 My solutions for Advent of Code 2021. About · What is Advent of Code? · Contents · Usage · Table of puzzles (TODO: add final

Amanda P. Pinha 2 Dec 05, 2022
Mangá downloader (para leitura offline) voltado para sites e scans brasileiros.

yonde! yonde! (読んで!) é um mangá downloader (para leitura offline) voltado para sites e scans brasileiros. Também permite que você converta os capítulo

Yonde 8 Nov 28, 2021
School helper, helps you at your pyllabus's.

pyllabus, helps you at your syllabus's... WARNING: It won't run without config.py! You should add config.py yourself, it will include your APIKEY. e.g

Ahmet Efe AKYAZI 6 Aug 07, 2022
This is collection of Managementsystem programs: Hospital Management, Student Managemen, etc

Contribute in this repository and help other students with their assignment by adding python scripts for various management system programs.

GDSC BVP DET - Navi Mumbai 3 Mar 20, 2022
Modern robots.txt Parser for Python

Robots Exclusion Protocol Parser for Python Robots.txt parsing in Python. Goals Fetching -- helper utilities for fetching and parsing robots.txts, inc

Moz 176 Dec 16, 2022