Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Plugin Ygocard
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 Ygocard
Commits
1a8cc3ef
Commit
1a8cc3ef
authored
Jan 09, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bump
parent
cc28b40e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
225 additions
and
226 deletions
+225
-226
package-lock.json
package-lock.json
+206
-205
package.json
package.json
+5
-5
src/index.tsx
src/index.tsx
+14
-16
No files found.
package-lock.json
View file @
1a8cc3ef
This diff is collapsed.
Click to expand it.
package.json
View file @
1a8cc3ef
...
@@ -28,16 +28,16 @@
...
@@ -28,16 +28,16 @@
"homepage"
:
"
https://code.mycard.moe/3rdeye/koishi-plugin-ygocard
"
,
"homepage"
:
"
https://code.mycard.moe/3rdeye/koishi-plugin-ygocard
"
,
"dependencies"
:
{
"dependencies"
:
{
"
class-transformer
"
:
"
^0.5.1
"
,
"
class-transformer
"
:
"
^0.5.1
"
,
"
koishi-thirdeye
"
:
"
^11.1.2
0
"
,
"
koishi-thirdeye
"
:
"
^11.1.2
1
"
,
"
leven
"
:
"
3.1
"
,
"
leven
"
:
"
3.1
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
mustache
"
:
"
^4.2.0
"
,
"
mustache
"
:
"
^4.2.0
"
,
"
sql.js
"
:
"
^1.8.0
"
"
sql.js
"
:
"
^1.8.0
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@koishijs/plugin-console
"
:
"
^5.
0.2
"
,
"
@koishijs/plugin-console
"
:
"
^5.
1.0
"
,
"
@koishijs/plugin-database-memory
"
:
"
^2.2.
0
"
,
"
@koishijs/plugin-database-memory
"
:
"
^2.2.
2
"
,
"
@koishijs/plugin-help
"
:
"
^2.0.
1
"
,
"
@koishijs/plugin-help
"
:
"
^2.0.
2
"
,
"
@koishijs/plugin-sandbox
"
:
"
^2.5.0
"
,
"
@koishijs/plugin-sandbox
"
:
"
^2.5.0
"
,
"
@types/jest
"
:
"
^29.2.0
"
,
"
@types/jest
"
:
"
^29.2.0
"
,
"
@types/lodash
"
:
"
^4.14.175
"
,
"
@types/lodash
"
:
"
^4.14.175
"
,
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
"
ws
"
:
"
^8.3.0
"
"
ws
"
:
"
^8.3.0
"
},
},
"peerDependencies"
:
{
"peerDependencies"
:
{
"koishi"
:
"^4.11.
0
"
"koishi"
:
"^4.11.
1
"
},
},
"jest"
:
{
"jest"
:
{
"moduleFileExtensions"
:
[
"moduleFileExtensions"
:
[
...
...
src/index.tsx
View file @
1a8cc3ef
...
@@ -94,7 +94,7 @@ export default class YGOCardPlugin
...
@@ -94,7 +94,7 @@ export default class YGOCardPlugin
@
PutSession
()
session
:
Session
,
@
PutSession
()
session
:
Session
,
)
{
)
{
if
(
!
query
)
{
if
(
!
query
)
{
await
session
.
send
(
<
i18n
path=
{
'
.prompt-input
'
}
/>
);
await
session
.
send
(
session
.
text
(
'
.prompt-input
'
)
);
query
=
await
session
.
prompt
();
query
=
await
session
.
prompt
();
}
}
if
(
!
query
)
return
;
if
(
!
query
)
return
;
...
@@ -103,7 +103,7 @@ export default class YGOCardPlugin
...
@@ -103,7 +103,7 @@ export default class YGOCardPlugin
}
}
const
cards
=
this
.
queryInAllDBs
(
query
,
count
);
const
cards
=
this
.
queryInAllDBs
(
query
,
count
);
if
(
!
cards
.
length
)
{
if
(
!
cards
.
length
)
{
return
<
i18n
path=
{
'
.not-found
'
}
/>
;
return
session
.
text
(
'
.not-found
'
)
;
}
}
if
(
cards
.
length
===
1
)
{
if
(
cards
.
length
===
1
)
{
return
cards
[
0
].
getDisplayString
(
this
.
config
);
return
cards
[
0
].
getDisplayString
(
this
.
config
);
...
@@ -111,19 +111,17 @@ export default class YGOCardPlugin
...
@@ -111,19 +111,17 @@ export default class YGOCardPlugin
const
itemLines
=
cards
.
map
((
c
,
i
)
=>
`
${
i
+
1
}
.
${
c
.
getIdAndName
()}
`
);
const
itemLines
=
cards
.
map
((
c
,
i
)
=>
`
${
i
+
1
}
.
${
c
.
getIdAndName
()}
`
);
const
borderLength
=
Math
.
max
(...
itemLines
.
map
((
l
)
=>
l
.
length
))
+
1
;
const
borderLength
=
Math
.
max
(...
itemLines
.
map
((
l
)
=>
l
.
length
))
+
1
;
await
session
.
send
(
await
session
.
send
(
<>
session
.
text
(
'
.select-prefix-part1
'
)
+
<
i18n
path=
{
'
.select-prefix-part1
'
}
/>
query
+
{
query
}
session
.
text
(
'
.select-prefix-part2
'
)
+
<
i18n
path=
{
'
.select-prefix-part2
'
}
/>
'
\n
'
+
{
'
\n
'
}
_
.
repeat
(
'
-
'
,
borderLength
)
+
{
_
.
repeat
(
'
-
'
,
borderLength
)
}
'
\n
'
+
{
'
\n
'
}
itemLines
.
join
(
'
\n
'
)
+
{
itemLines
.
join
(
'
\n
'
)
}
'
\n
'
+
{
'
\n
'
}
_
.
repeat
(
'
-
'
,
borderLength
)
+
{
_
.
repeat
(
'
-
'
,
borderLength
)
}
'
\n
'
+
{
'
\n
'
}
session
.
text
(
'
.select-suffix
'
)
<
i18n
path=
{
'
.select-suffix
'
}
/>
</>,
);
);
const
reply
=
await
session
.
prompt
();
const
reply
=
await
session
.
prompt
();
if
(
!
reply
)
{
if
(
!
reply
)
{
...
@@ -137,7 +135,7 @@ export default class YGOCardPlugin
...
@@ -137,7 +135,7 @@ export default class YGOCardPlugin
cards
.
find
((
c
)
=>
c
.
name
.
includes
(
reply
))
||
cards
.
find
((
c
)
=>
c
.
name
.
includes
(
reply
))
||
cards
.
find
((
c
)
=>
c
.
desc
.
includes
(
reply
));
cards
.
find
((
c
)
=>
c
.
desc
.
includes
(
reply
));
if
(
!
card
)
{
if
(
!
card
)
{
return
<
i18n
path=
{
'
.not-found
'
}
/>
;
return
session
.
text
(
'
.not-found
'
)
;
}
}
return
card
.
getDisplayString
(
this
.
config
);
return
card
.
getDisplayString
(
this
.
config
);
}
}
...
...
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