Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit 7942d3c

Browse files
author
简律纯
authoredApr 21, 2023
Initial commit
0 parents  commit 7942d3c

File tree

6 files changed

+795
-0
lines changed

6 files changed

+795
-0
lines changed
 

‎.github/workflows/ci.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ main ]
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
env:
10+
PACK_NAME: ""
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Pack
15+
run: |
16+
if [ ! $PACK_NAME ]; then
17+
PACK_NAME=${GITHUB_REPOSITORY##*/}
18+
fi
19+
echo "PACK_NAME=$PACK_NAME" >> $GITHUB_ENV
20+
cd $PACK_NAME
21+
zip -r ../$PACK_NAME.opk ./
22+
- name: Upload
23+
uses: actions/upload-artifact@v3
24+
with:
25+
name: Artifacts
26+
path: ${{ env.PACK_NAME }}.opk
27+
- name: 读取当前版本号
28+
id: version
29+
uses: ashley-taylor/read-json-property-action@v1.0
30+
with:
31+
path: ./${{ env.PACK_NAME }}/app.json
32+
property: version
33+
34+
# - name: 读取描述文件(若有)
35+
# id: description
36+
# uses: juliangruber/read-file-action@v1
37+
# with:
38+
# path: ./description.txt
39+
40+
#- name: 创建GitHub Release
41+
# id: create_release
42+
# uses: actions/create-release@latest
43+
# env:
44+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
# with:
46+
# tag_name: v${{steps.version.outputs.value}}
47+
# release_name: v${{steps.version.outputs.value}}
48+
# # body: {{steps.description.outputs.content}}
49+
# draft: true
50+
# prerelease: false
51+
#- name: 上传opk文件
52+
# uses: actions/upload-release-asset@v1.0.1
53+
# env:
54+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
# with:
56+
# upload_url: ${{ steps.create_release.outputs.upload_url }}
57+
# asset_path: ${{ env.PACK_NAME }}.opk
58+
# asset_name: ${{ env.PACK_NAME }}.opk
59+
# asset_content_type: application/zip

‎LICENSE

+661
Large diffs are not rendered by default.

‎OlivOSPluginTemplate/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import main

‎OlivOSPluginTemplate/app.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name" : "OlivOS插件默认模板",
3+
"author" : "OlivOS-Team",
4+
"namespace" : "OlivOSPluginTemplate",
5+
"info" : "这是OlivOS官方插件模板,而这是一条有关插件的简介。",
6+
"priority" : 30000,
7+
"svn" : 1,
8+
"version" : "1.0.0",
9+
"compatible_svn" : 100,
10+
"message_mode" : "olivos_string",
11+
"support" : [
12+
{
13+
"sdk" : "onebot",
14+
"platform" : "qq",
15+
"model" : "all"
16+
},
17+
{
18+
"sdk" : "all",
19+
"platform" : "all",
20+
"model" : "all"
21+
}
22+
],
23+
"menu_config": [
24+
{
25+
"title": "插件菜单1",
26+
"event": "OlivOSPluginTemplate_Menu_001"
27+
},
28+
{
29+
"title": "插件菜单2",
30+
"event": "OlivOSPluginTemplate_Menu_002"
31+
}
32+
]
33+
}

‎OlivOSPluginTemplate/main.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import OlivOS
2+
import OlivOSPluginTemplate
3+
4+
class Event(object):
5+
def init(plugin_event, Proc):
6+
pass
7+
8+
def private_message(plugin_event, Proc):
9+
unity_reply(plugin_event, Proc)
10+
11+
def group_message(plugin_event, Proc):
12+
unity_reply(plugin_event, Proc)
13+
14+
def poke(plugin_event, Proc):
15+
poke_reply(plugin_event, Proc)
16+
17+
def save(plugin_event, Proc):
18+
pass
19+
20+
def menu(plugin_event, Proc):
21+
if plugin_event.data.namespace == 'OlivOSPluginTemplate':
22+
if plugin_event.data.event == 'OlivOSPluginTemplate_Menu_001':
23+
pass
24+
elif plugin_event.data.event == 'OlivOSPluginTemplate_Menu_002':
25+
pass
26+
27+
def unity_reply(plugin_event, Proc):
28+
if plugin_event.data.message == '/bot' or plugin_event.data.message == '.bot' or plugin_event.data.message == '[CQ:at,qq=' + str(plugin_event.base_info['self_id']) + '] .bot':
29+
plugin_event.reply('OlivOSPluginTemplate')
30+
31+
def poke_reply(plugin_event, Proc):
32+
if plugin_event.data.target_id == plugin_event.base_info['self_id']:
33+
plugin_event.reply('OlivOSPluginTemplate')
34+
elif plugin_event.data.target_id == plugin_event.data.user_id:
35+
plugin_event.reply('OlivOSPluginTemplate')
36+
elif plugin_event.data.group_id == -1:
37+
plugin_event.reply('OlivOSPluginTemplate')
38+

‎README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# OlivOSPluginTemplate
2+
3+
`./OlivOSPluginTemplate` 目录整体为[OlivOS](https://github.com/OlivOS-Team/OlivOS)插件默认模板,请结合使用。

0 commit comments

Comments
 (0)
This repository has been archived.