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
Tool to generate wrappers for Linux libraries allowing for dlopen()ing them without writing any boilerplate

Dynload wrapper This program will generate a wrapper to make it easy to dlopen() shared objects on Linux without writing a ton of boilerplate code. Th

Hein-Pieter van Braam 25 Oct 24, 2022
Sample microservices application demo

Development mode docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d or export COMPOSE_FILE='docker-compose.yml:docker-compose.dev.ym

Konstantinos Bairaktaris 1 Nov 14, 2021
A person does not exist image bot

A person does not exist image bot

Fayas Noushad 3 Dec 12, 2021
[x]it! support for working with todo and check list files in Sublime Text

[x]it! for Sublime Text This Sublime Package provides syntax-highlighting, shortcuts, and auto-completions for [x]it! files. Features Syntax highlight

Jan Heuermann 18 Sep 19, 2022
Tesla App Update Differences Extractor

Tesla App Update Differences Extractor Python program that finds the differences between two versions of the Tesla App. When Tesla updates the app a l

Adrian 5 Apr 11, 2022
Sathal's Python Projects Repository

Sathal's Python Projects Repository Purpose and Motivation I come from a mainly C Programming Language background and have previous classroom experien

Sam 1 Oct 20, 2021
The Official interpreter for the Pix programming language.

The official interpreter for the Pix programming language. Pix Pix is a programming language dedicated to readable syntax and usability Q) Is Pix the

Pix 6 Sep 25, 2022
Manage Procfile-based applications

Foreman Manage Procfile-based applications Installation $ gem install foreman Ruby users should take care not to install foreman in their project's G

David Dollar 5.8k Jan 03, 2023
For Tok-k passages that have passed through the Bi-Encoder Retrival, ReRank is performed using CrossEncoder.

Cross-Encoder-with-Bi-Encoder For Tok-k passages that have passed through the Bi-Encoder Retrival, ReRank is performed using CrossEncoder. Data Data u

7 Feb 09, 2022
WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 Release Ready

WhyNotWin11 - Detection Script to help identify why your PC isn't Windows 11 Release Ready

Robert C. Maehl 5.9k Dec 31, 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
A similarity measurer on two programming assignments on Online Judge.

A similarity measurer on two programming assignments on Online Judge. Algorithm implementation details are at here. Install Recommend OS: Ubuntu 20.04

StardustDL 6 May 21, 2022
Automatic and platform-independent unpacker for Windows binaries based on emulation

_ _ __ _ __ _ | | | | / / (_) \ \ | | | | | |_ __ | | _ | | _ __ __ _ ___| | _____ _ __

514 Dec 21, 2022
Hashcrack: Hash Bruteforse tool using python

HashCrack Hash Bruteforse tool Usage hashcrack.py -n 6 -c lower -l 5 -a md5 -t 3

Lev 1 May 04, 2022
Example platform plugin that fixes fentry calls in Binja

Example Binja Platform Plugin This is an example Binja platform plugin which fixes up linux kernel module calls to __fentry__. __fentry__ is the linux

_yrp 2 Oct 07, 2021
x-tools is a collection of tools developed in Python

x-tools X-tools is a collection of tools developed in Python Commands\

5 Jan 24, 2022
Incident Response Process and Playbooks | Goal: Playbooks to be Mapped to MITRE Attack Techniques

PURPOSE OF PROJECT That this project will be created by the SOC/Incident Response Community Develop a Catalog of Incident Response Playbook for every

Austin Songer 987 Jan 02, 2023
VHDL to Discrete Logic on PCB Flow

PCBFlow Highly experimental set of scripts to transform a digital circuit described in a hardware description language (VHDL or Verilog) into a discre

Tim 77 Nov 04, 2022
Modelling the 30 salamander problem from `Pure Mathematics` by Martin Liebeck

Salamanders on an island The Problem From A Concise Introduction to Pure Mathematics By Martin Liebeck Critic Ivor Smallbrain is watching the horror m

Faisal Jina 1 Jul 10, 2022
Todo-backend - Todo backend with python

Todo-backend - Todo backend with python

Julio C. Diaz 1 Jan 07, 2022