Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-act
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
koishi-plugin-act
Commits
d1a62ebb
Commit
d1a62ebb
authored
Oct 05, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid internal as possible, use string groupId
parent
6a5b5308
Pipeline
#6098
passed with stages
in 1 minute and 40 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
15 deletions
+14
-15
README.md
README.md
+3
-3
package.json
package.json
+1
-1
src/playbook/Show.ts
src/playbook/Show.ts
+5
-6
src/plugin.ts
src/plugin.ts
+5
-5
No files found.
README.md
View file @
d1a62ebb
...
@@ -54,10 +54,10 @@ export interface Config {
...
@@ -54,10 +54,10 @@ export interface Config {
## 命令
## 命令
*
`act [groupId:
number
]`
获取公演状态。不带参数获取所有正在公演的群,带参数则获取特定群。
*
`act [groupId:
string
]`
获取公演状态。不带参数获取所有正在公演的群,带参数则获取特定群。
*
`act.create <groupId:
number
> <playbookFilename:string> [...specificCharacters]`
创建公演
*
`act.create <groupId:
string
> <playbookFilename:string> [...specificCharacters]`
创建公演
*
`groupId`
目标群。
`playbookFilename`
是公演剧本文件,需要在服务器放好。后面的参数可以以 人物名=帐号 的形式指定特定的人物,否则随机分配。
*
`groupId`
目标群。
`playbookFilename`
是公演剧本文件,需要在服务器放好。后面的参数可以以 人物名=帐号 的形式指定特定的人物,否则随机分配。
*
例:
`act.create 11111111 play1 幽幽子=2222222`
在群 11111111 创建一个公演,剧本是 play1,位于
`/path/to/playbookPathPrefix/play1.json`
,同时指定人物幽幽子为 2222222 扮演。
*
例:
`act.create 11111111 play1 幽幽子=2222222`
在群 11111111 创建一个公演,剧本是 play1,位于
`/path/to/playbookPathPrefix/play1.json`
,同时指定人物幽幽子为 2222222 扮演。
*
`.delete <groupId:
number
>`
停止公演。
*
`.delete <groupId:
string
>`
停止公演。
package.json
View file @
d1a62ebb
{
{
"name"
:
"koishi-plugin-act"
,
"name"
:
"koishi-plugin-act"
,
"version"
:
"2.0.
1
"
,
"version"
:
"2.0.
2
"
,
"description"
:
"A plugin playing acts in QQ groups"
,
"description"
:
"A plugin playing acts in QQ groups"
,
"main"
:
"dist/index.js"
,
"main"
:
"dist/index.js"
,
"typings"
:
"dist/index.d.ts"
,
"typings"
:
"dist/index.d.ts"
,
...
...
src/playbook/Show.ts
View file @
d1a62ebb
...
@@ -16,14 +16,14 @@ export class Show {
...
@@ -16,14 +16,14 @@ export class Show {
private
step
=
0
;
private
step
=
0
;
private
launchTime
:
Moment
;
private
launchTime
:
Moment
;
constructor
(
constructor
(
public
groupId
:
number
,
public
groupId
:
string
,
private
playbook
:
Playbook
,
private
playbook
:
Playbook
,
private
autoChangeName
=
false
,
private
autoChangeName
=
false
,
)
{
)
{
for
(
const
character
of
playbook
.
characters
)
{
for
(
const
character
of
playbook
.
characters
)
{
character
.
playFun
=
async
(
line
,
text
)
=>
{
character
.
playFun
=
async
(
line
,
text
)
=>
{
const
bot
=
this
.
characterBotMap
.
get
(
character
.
id
);
const
bot
=
this
.
characterBotMap
.
get
(
character
.
id
);
await
bot
.
internal
.
sendGroupMsg
(
this
.
groupId
,
text
,
true
);
await
bot
.
sendGuildMessage
(
this
.
groupId
,
text
);
};
};
}
}
}
}
...
@@ -45,14 +45,13 @@ export class Show {
...
@@ -45,14 +45,13 @@ export class Show {
if
(
bot
.
adapter
.
platform
!==
'
onebot
'
)
{
if
(
bot
.
adapter
.
platform
!==
'
onebot
'
)
{
continue
;
continue
;
}
}
const
groups
=
await
bot
.
internal
.
getGroup
List
();
const
groups
=
await
bot
.
getGuild
List
();
const
matchGroup
=
groups
.
find
((
g
)
=>
g
.
g
roup_i
d
===
this
.
groupId
);
const
matchGroup
=
groups
.
find
((
g
)
=>
g
.
g
uildI
d
===
this
.
groupId
);
if
(
matchGroup
)
{
if
(
matchGroup
)
{
availableBots
.
push
(
bot
);
availableBots
.
push
(
bot
);
botNameMap
.
set
(
botNameMap
.
set
(
bot
.
selfId
.
toString
(),
bot
.
selfId
.
toString
(),
(
await
bot
.
internal
.
getGroupMemberInfo
(
this
.
groupId
,
bot
.
selfId
))
(
await
bot
.
getGuildMember
(
this
.
groupId
,
bot
.
selfId
)).
nickname
,
.
nickname
,
);
);
}
}
}
}
...
...
src/plugin.ts
View file @
d1a62ebb
...
@@ -37,7 +37,7 @@ export class MyPlugin {
...
@@ -37,7 +37,7 @@ export class MyPlugin {
config
:
Config
;
config
:
Config
;
ctx
:
Context
;
ctx
:
Context
;
adminCtx
:
Context
;
adminCtx
:
Context
;
shows
=
new
Map
<
number
,
Show
>
();
shows
=
new
Map
<
string
,
Show
>
();
name
=
'
act-main
'
;
name
=
'
act-main
'
;
schema
:
Schema
<
Config
>
=
Schema
.
object
({
schema
:
Schema
<
Config
>
=
Schema
.
object
({
...
@@ -60,7 +60,7 @@ export class MyPlugin {
...
@@ -60,7 +60,7 @@ export class MyPlugin {
}
}
this
.
adminCtx
=
this
.
ctx
.
select
(
this
.
config
.
adminContext
);
this
.
adminCtx
=
this
.
ctx
.
select
(
this
.
config
.
adminContext
);
const
showComamnd
=
this
.
adminCtx
const
showComamnd
=
this
.
adminCtx
.
command
(
'
act [groupId:
number
]
'
,
'
获取公演状态
'
)
.
command
(
'
act [groupId:
string
]
'
,
'
获取公演状态
'
)
.
usage
(
'
不带参数获取所有正在公演的群,带参数则获取特定群。
'
)
.
usage
(
'
不带参数获取所有正在公演的群,带参数则获取特定群。
'
)
.
action
((
argv
,
groupId
)
=>
{
.
action
((
argv
,
groupId
)
=>
{
if
(
!
groupId
)
{
if
(
!
groupId
)
{
...
@@ -77,7 +77,7 @@ export class MyPlugin {
...
@@ -77,7 +77,7 @@ export class MyPlugin {
showComamnd
showComamnd
.
subcommand
(
.
subcommand
(
'
.create <groupId:
number
> <playbookFilename:string> [...specificCharacters]
'
,
'
.create <groupId:
string
> <playbookFilename:string> [...specificCharacters]
'
,
'
创建公演
'
,
'
创建公演
'
,
)
)
.
usage
(
.
usage
(
...
@@ -100,7 +100,7 @@ export class MyPlugin {
...
@@ -100,7 +100,7 @@ export class MyPlugin {
},
},
);
);
showComamnd
showComamnd
.
subcommand
(
'
.delete <groupId:
number
>
'
,
'
停止
'
)
.
subcommand
(
'
.delete <groupId:
string
>
'
,
'
停止
'
)
.
usage
(
'
groupId 目标群。
'
)
.
usage
(
'
groupId 目标群。
'
)
.
example
(
'
act.delete 11111111 停止群 11111111 的公演。
'
)
.
example
(
'
act.delete 11111111 停止群 11111111 的公演。
'
)
.
action
((
argv
,
groupId
)
=>
{
.
action
((
argv
,
groupId
)
=>
{
...
@@ -118,7 +118,7 @@ export class MyPlugin {
...
@@ -118,7 +118,7 @@ export class MyPlugin {
async
createShow
(
async
createShow
(
session
:
Session
,
session
:
Session
,
groupId
:
number
,
groupId
:
string
,
playbookFilename
:
string
,
playbookFilename
:
string
,
specificCharacters
:
string
[]
=
[],
specificCharacters
:
string
[]
=
[],
)
{
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment