test
This commit is contained in:
parent
faf6b39e45
commit
aaa1ee91ae
35
src/plugins/YiYanAPI/.gitignore
vendored
35
src/plugins/YiYanAPI/.gitignore
vendored
@ -1,35 +0,0 @@
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# Virtual Environment
|
||||
venv/
|
||||
ENV/
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
@ -1,2 +0,0 @@
|
||||
# YiYanAPI
|
||||
只要你发一言,就会给你一言
|
@ -1,3 +0,0 @@
|
||||
from .main import YiYanAPI
|
||||
|
||||
__all__ = ["YiYanAPI"]
|
@ -1,28 +0,0 @@
|
||||
import requests
|
||||
from ncatbot.plugin import BasePlugin, CompatibleEnrollment
|
||||
from ncatbot.core import GroupMessage, PrivateMessage, BaseMessage
|
||||
|
||||
bot = CompatibleEnrollment # 兼容回调函数注册器
|
||||
|
||||
|
||||
class YiYanAPI(BasePlugin):
|
||||
name = "YiYanAPI" # 插件名称
|
||||
version = "0.0.1" # 插件版本
|
||||
author = "pythagodzilla" # 插件作者
|
||||
info = "每日一言" # 插件描述
|
||||
|
||||
@bot.private_event()
|
||||
async def on_message(self, msg: PrivateMessage):
|
||||
if msg.message[0]["type"] == "text":
|
||||
if msg.raw_message == "一言":
|
||||
content = requests.get("https://v1.hitokoto.cn/?c=f&encode=text").text
|
||||
|
||||
await self.api.post_private_msg(msg.user_id, content)
|
||||
|
||||
@bot.group_event()
|
||||
async def on_message(self, msg: GroupMessage):
|
||||
if msg.message[0]["type"] == "text":
|
||||
if msg.raw_message == "一言":
|
||||
content = requests.get("https://v1.hitokoto.cn/?c=f&encode=text").text
|
||||
|
||||
await self.api.post_group_msg(msg.group_id, content)
|
@ -1,2 +0,0 @@
|
||||
# 插件依赖项
|
||||
# 例如: requests==2.28.1
|
Loading…
x
Reference in New Issue
Block a user