-
Notifications
You must be signed in to change notification settings - Fork 27
/
strokeorder.js
39 lines (35 loc) · 1.56 KB
/
strokeorder.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { throwPublicErrorInfo } = require('./../common/util/errors.js');
const createStrokeOrderNavigationChapter = require('./../discord/create_stroke_order_search_navigation_chapter.js');
const { Navigation } = require('monochrome-bot');
const constants = require('./../common/constants.js');
module.exports = {
commandAliases: ['strokeorder', 's', 'so'],
canBeChannelRestricted: true,
cooldown: 3,
uniqueId: 'strokeorder303489',
shortDescription: 'Search for details about a kanji\'s strokes.',
longDescription: 'Search for details about a kanji\'s strokes. For most kanji, I will provide a sequential stroke order diagram from Jisho and a stroke order gif generated from KanjiVG data. If you enter more than one character, I\'ll show results for all of them.',
usageExample: '<prefix>strokeorder 少',
action(bot, msg, suffix, monochrome) {
if (!suffix) {
const { prefix } = msg;
return throwPublicErrorInfo('Stroke Order Search', `Say **${prefix}strokeorder [kanji]** to search for stroke order information. For example: **${prefix}strokeorder 瞬間**. Say **${prefix}help strokeorder** for more help.`, 'No suffix');
}
const { navigationChapter, pageCount } = createStrokeOrderNavigationChapter(
suffix,
msg.author.username,
false,
);
const navigation = Navigation.fromOneNavigationChapter(
msg.author.id,
navigationChapter,
pageCount > 1,
);
return monochrome.getNavigationManager().show(
navigation,
constants.NAVIGATION_EXPIRATION_TIME,
msg.channel,
msg,
);
},
};