Skip to content

Commit

Permalink
Merge pull request #6 from ICEAGENB/master
Browse files Browse the repository at this point in the history
  • Loading branch information
BIYUEHU authored Dec 8, 2024
2 parents 132be50 + da6015c commit 8b23784
Show file tree
Hide file tree
Showing 339 changed files with 15,867 additions and 12,947 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ log
data

*.env
.env
*.tgz
*.log
tsconfig.tsbuildinfo
test.http

kotori.dev.*
*.mjs
*.res.js
39 changes: 0 additions & 39 deletions .idea/workspace.xml

This file was deleted.

7 changes: 7 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
- [ ] rss subscribe service plugin
- [x] protect daemon and auto install
- [x] hide update url
- [ ] filter supports session events
- [ ] jsonc developing plugins
- [ ] new plugin workspace
- [ ] complex building workspace (supports res)
- [ ] modules category directorys

## Styles

Expand All @@ -45,3 +50,5 @@
- [x] kotori-plugin-request: onGroupMsg and onPrivateMsg
- [x] webui load tips twice
- [x] symbols props inject and reality context
- [ ] project createing cli bugs
- [ ] webui analyze data bugs
9 changes: 8 additions & 1 deletion kotori.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ port = 720
dbPrefix = "romiChan"
lang = "en_US"
commandPrefix = "/"
dirs = []
dirs = [
"modules",
"modules/base",
"modules/platform",
"modules/test",
"modules/tools",
"modules/amuse",
]
noColor = false
level = 25

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions modules/amuse/random-img/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "kotori-plugin-randomimg",
"version": "1.2.4",
"description": "Random imgs base for Core",
"main": "lib/index.js",
"keywords": [
"kotori",
"chatbot",
"kotori-plugin"
],
"license": "BCU",
"files": [
"lib",
"locales",
"LICENSE",
"README.md"
],
"author": "Hotaru <[email protected]>",
"peerDependencies": {
"kotori-bot": "workspace:^"
},
"kotori": {
"meta": {
"language": [
"en_US",
"ja_JP",
"zh_TW",
"zh_CN"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tsu, type Context, Messages } from 'kotori-bot'
import { Tsu, type Context } from 'kotori-bot'

const sexSchema = Tsu.Object({
data: Tsu.Array(
Expand Down Expand Up @@ -33,8 +33,15 @@ export function main(ctx: Context) {
if (!res.data) return session.format('random_img.msg.sex.fail', [data.args[0]])

const info = res.data[0]
session.quick(['random_img.msg.sex', [info.pid, info.title, info.author, info.tags.join(' ')]])
return Messages.image(info.url)
// session.quick(['random_img.msg.sex', [info.pid, info.title, info.author, info.tags.join(' ')]])
return (
<format template={session.t`random_img.msg.sex`}>
<text>{info.pid.toString()}</text>
<text>{info.title}</text>
<text>{info.author}</text>
<text>{info.tags.join(' ')}</text>
</format>
)
})

// ctx.command('sexh [tags] - random_img.descr.sexh').action(async (data, session) => {
Expand All @@ -52,26 +59,31 @@ export function main(ctx: Context) {
const result1 = text.match(/<url>(.*?)<\/url>/)
const result2 = text.match(/<copyright>(.*?)<\/copyright>/)
if (!result1 || !result2) return 'random_img.msg.fail'
return session.format('random_img.msg.bing', [Messages.image(`https://cn.bing.com${result1[1]}`), result2[1]])
return (
<format template={session.t`random_img.msg.bing`}>
<image src={`https://cn.bing.com${result1[1]}`} />
<text>{result2[1]}</text>
</format>
)
})

ctx.command('day - random_img.descr.day').action((_, session) => {
session.quick('random_img.msg.sex.tips')
return Messages.image('https://api.hotaru.icu/api/60s?apikey=1c42abefdb5f7cc463dbc88e82d561b1&area=日本神户市')
return <image src="https://api.hotaru.icu/api/60s?apikey=1c42abefdb5f7cc463dbc88e82d561b1&area=日本神户市" />
})

ctx.command('earth - random_img.descr.earth').action((_, session) => {
session.quick('random_img.msg.sex.tips')
return Messages.image('https://img.nsmc.org.cn/CLOUDIMAGE/FY4A/MTCC/FY4A_DISK.jpg')
return <image src="https://img.nsmc.org.cn/CLOUDIMAGE/FY4A/MTCC/FY4A_DISK.jpg" />
})

ctx.command('china - random_img.descr.china').action((_, session) => {
session.quick('random_img.msg.sex.tips')
return Messages.image('https://img.nsmc.org.cn/CLOUDIMAGE/FY4A/MTCC/FY4A_CHINA.jpg')
return <image src="https://img.nsmc.org.cn/CLOUDIMAGE/FY4A/MTCC/FY4A_CHINA.jpg" />
})

ctx.command('beauty - random_img.descr.beauty').action((_, session) => {
session.quick('random_img.msg.sex.tips')
return Messages.image('https://api.hotaru.icu/api/beautyimg')
return <image src="https://api.hotaru.icu/api/beautyimg" />
})
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions modules/base/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@kotori-bot/kotori-plugin-core",
"version": "1.4.5",
"description": "core plugin",
"main": "lib/index.js",
"keywords": [
"kotori",
"chatbot",
"kotori-plugin"
],
"license": "BCU",
"files": [
"lib",
"locales",
"LICENSE",
"README.md"
],
"author": "Hotaru <[email protected]>",
"peerDependencies": {
"kotori-bot": "workspace:^"
},
"kotori": {
"meta": {
"language": [
"en_US",
"ja_JP",
"zh_TW",
"zh_CN"
]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions modules/base/helper/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@kotori-bot/kotori-plugin-helper",
"version": "1.4.0",
"description": "helper and menu plugin",
"main": "lib/index.js",
"keywords": [
"kotori",
"chatbot",
"kotori-plugin"
],
"license": "BCU",
"files": [
"lib",
"locales",
"LICENSE",
"README.md"
],
"author": "Hotaru <[email protected]>",
"peerDependencies": {
"kotori-bot": "workspace:^"
},
"kotori": {
"meta": {
"language": [
"en_US",
"ja_JP",
"zh_TW",
"zh_CN"
]
}
}
}
12 changes: 12 additions & 0 deletions modules/helper/src/index.ts → modules/base/helper/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ export function main(ctx: Context, cfg: Tsu.infer<typeof config>) {
if (cfg.alias) cmd.alias(cfg.alias)
}

ctx.on('before_command', (data) => {
if (data.command.meta.options.some((val) => val.realname === 'help' || val.name === 'H')) return
if (![' --help', ' -H', ' -h'].some((val) => data.raw.includes(val))) return
data.cancel()
ctx.emit(
'on_message',
Object.assign(data.session, {
message: <text>{`${data.session.api.adapter.config.commandPrefix}help ${data.command.meta.root}`}</text>
})
)
})

ctx.command('help [...command] - helper.descr.help').action((data, session) => {
const args = data.args.join(' ')
const filterResult: Command['meta'][] = []
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions modules/browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# @kotori-bot/browser
44 changes: 44 additions & 0 deletions modules/browser/locales/en_US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"corei18n.template.args_error": "The type of argument \"{0}\" is incorrect, expected type: {1}, actual type: {2}",
"corei18n.template.args_few": "Fewer arguments than expected were provided. Expected number: {0}, actual number: {1}",
"corei18n.template.args_many": "More arguments than expected were provided. Please reduce the number of arguments. Expected number: {0}, actual number: {1}",
"corei18n.template.option_error": "The type of option \"{0}\" is incorrect, expected type: {1}, actual type: {2}",
"corei18n.template.syntax": "Syntax error in command. Unexpected character \"{1}\" at position {0}",
"corei18n.template.unknown": "Unknown command \"{0}\". Please check if the command is entered correctly",
"corei18n.template.error": "An unexpected error has occurred!\nCaptured information: {0}",
"corei18n.template.res_error": "Error in response data format!\nError message: {0}",
"corei18n.template.num_error": "Incorrect sequence number, please resend",
"corei18n.template.exists": "The target argument \"{0}\" already exists, do not execute repeatedly",
"corei18n.template.no_exists": "The target argument \"{0}\" does not exist, please confirm and resend",
"corei18n.template.data_error.args": "Error in data passed to argument \"{0}\"",
"corei18n.template.data_error.options": "Error in data passed to option \"{0}\"",
"corei18n.template.scope": "This command can only be used in group chats or private chats!",
"corei18n.template.no_access_manger": "This command can only be used by group managers and group BOT administrators!",
"corei18n.template.no_access_admin": "This command can only be used by the highest administrator of the BOT!",
"corei18n.template.empty": "None",
"corei18n.template.unsupported": "The current platform does not support this message element",
"corei18n.template": "The current platform does not support this message element",
"corei18n.template.prompt": "Please enter a value:",
"corei18n.template.confirm": "Are you sure? (Yes/No)",
"corei18n.template.confirm.sure": "Yes",
"core.descr.core": "View instance statistics information",
"core.descr.bot": "View information and status of the current bot",
"core.descr.bots": "View information and status of all bots",
"core.descr.about": "View about information",
"core.descr.locale": "Set the display language",
"core.descr.module": "View the list of modules",
"core.msg.bot": "ID: %identity%\nLanguage: %lang%\nPlatform: %platform%\nID: %self_id%\nConnection time: %create_time%\nNumber of received messages: %received_msg%\nNumber of sent messages: %sent_msg%\nNumber of instance shutdowns: %offline_times%\nLast message time: %last_msg_time%",
"core.msg.core": "Global language: %lang%\nInstance directory: %root%\nRunning mode: %mode%\nNumber of modules: %modules%\nNumber of services: %services%\nNumber of bot instances: %bots%\nNumber of middlewares: %midwares%\nNumber of commands: %commands%\nNumber of regular expressions: %regexps%",
"core.msg.bots": "Instance list: %list%",
"core.msg.bots.list": "\n----------\nID: %identity%\nLanguage: %lang%\nPlatform: %platform%\nStatus: %status%",
"core.msg.about": "Kotori version: %version%\nCore version: %core_version%\nLoader version: %loader_version%\nLicense: %license%\nNodeJS version: %node_version%",
"core.msg.locale": "Successfully set the display language for the current instance to: %lang%",
"core.msg.locale.global": "Successfully set the global display language to: %lang%",
"core.msg.locale.invalid": "Parameter is invalid, must be one of the following values: en_US, ja_JP, zh_CN, zh_TW",
"core.msg.module": "Module list: %list%",
"core.msg.module.list": "\n----------\nName: %name%\nDescription: %description%\nVersion: %version%",
"core.msg.module.not_found": "Module %name% not found",
"core.descr.restart": "Restart the Kotori program",
"core.msg.restart": "Kotori is restarting...",
"core.msg.restart.not_daemon": "Error, need daemon environment"
}
41 changes: 41 additions & 0 deletions modules/browser/locales/ja_JP.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"corei18n.template.args_error": "パラメータ「{0}」の型が誤っています。期待する型:{1}、実際の型:{2}",
"corei18n.template.args_few": "期待される引数の数が不足しています。期待される数:{0}、実際の数:{1}",
"corei18n.template.args_many": "引数の数が多すぎます。期待される数:{0}、実際の数:{1}",
"corei18n.template.option_error": "オプション「{0}」の型が誤っています。期待する型:{1}、実際の型:{2}",
"corei18n.template.syntax": "コマンドの構文エラー、{0}の位置で予期しない文字「{1}」",
"corei18n.template.unknown": "未知のコマンド「{0}」、コマンドの入力を確認してください",
"corei18n.template.error": "予期しないエラーが発生しました!\n捕捉された情報:{0}",
"corei18n.template.res_error": "レスポンスデータの形式が誤っています!\nエラーメッセージ:{0}",
"corei18n.template.num_error": "番号が誤っています、再度送信してください",
"corei18n.template.exists": "対象のパラメータ「{0}」はすでに存在しています、繰り返し実行しないでください",
"corei18n.template.no_exists": "対象のパラメータ「{0}」は存在していません、確認後、再度送信してください",
"corei18n.template.data_error.args": "パラメータ「{0}」に誤ったデータが渡されました",
"corei18n.template.data_error.options": "オプション「{0}」に誤ったデータが渡されました",
"corei18n.template.scope": "このコマンドはグループチャットまたはプライベートチャットでのみ使用できます!",
"corei18n.template.no_access_manger": "このコマンドはグループ管理者およびBOT管理者のみ使用できます!",
"corei18n.template.no_access_admin": "このコマンドはBOTの最高管理者のみ使用できます!",
"corei18n.template.empty": "なし",
"corei18n.template.unsupported": "現在のプラットフォームではこのメッセージ要素はサポートされていません",
"corei18n.template": "現在のプラットフォームではこのメッセージ要素はサポートされていません",
"corei18n.template.prompt": "値を入力してください:",
"corei18n.template.confirm": "確認しますか?(はい/いいえ)",
"corei18n.template.confirm.sure": "はい",
"core.descr.core": "インスタンスの統計情報を表示します",
"core.descr.bot": "現在のBOTの情報と動作状況を表示します",
"core.descr.bots": "すべてのBOTの情報と動作状況を表示します",
"core.descr.about": "について情報を表示します",
"core.descr.locale": "表示言語を設定します",
"core.descr.module": "モジュールを表示します",
"core.msg.bot": "ID:%identity%\n言語:%lang%\nプラットフォーム:%platform%\nID:%self_id%\n接続時間:%create_time%\n受信メッセージ数:%received_msg%\n送信メッセージ数:%sent_msg%\nインスタンスオフライン回数:%offline_times%\n最後のメッセージ時間:%last_msg_time%",
"core.msg.core": "グローバル言語:%lang%\nインスタンスディレクトリ:%root%\n動作モード:%mode%\nモジュール数:%modules%\nサービス数:%services%\nBOTインスタンス数:%bots%\nミドルウェア数:%midwares%\nコマンド数:%commands%\n正規表現数:%regexps%",
"core.msg.bots": "インスタンスリスト:%list%",
"core.msg.bots.list": "\n----------\nID:%identity%\n言語:%lang%\nプラットフォーム:%platform%\n状態:%status%",
"core.msg.about": "Kotori バージョン:%version%\nライセンス:%license%\nNodeJS バージョン:%node_version%",
"core.msg.locale": "現在のインスタンスの表示言語を %lang% に設定しました",
"core.msg.locale.global": "グローバル表示言語を %lang% に設定しました",
"core.msg.locale.invalid": "パラメータが無効です。以下の値のいずれかでなければなりません:en_US、ja_JP、zh_CN、zh_TW",
"core.msg.module": "モジュールリスト:%list%",
"core.msg.module.list": "\n----------\n名前:%name%\n説明:%description%\nバージョン:%version%",
"core.msg.module.not_found": "%name% モジュールが見つかりませんでした"
}
Loading

0 comments on commit 8b23784

Please sign in to comment.