forked from qmk/qmk_helper_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
178 lines (169 loc) · 6.28 KB
/
utils.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// Help message content
const helpmessage = [
{
name: "**New Users**",
value: "tutorial, syllabus, building, flashing, testing, debugging"
},
{
name: "**FAQs**",
value: "faq, faq-build, faq-debug, faq-keymap, glossary"
},
{
name: "**Building, Flashing, Drivers**",
value: "configurator, api, zadig, toolbox, flashing, flashing-bootloadhid, keymap, vagrant, ide-eclipse, ide-vscode, git, hand-wire, isp-flashing, msys, vid, vidq, promicro, protonc, elitec"
},
{
name: "**QMK CLI**",
value: "cli, cli-configuration, cli-commands"
},
{
name: "**Keycodes**",
value: "keycodes, keycodes-basic, keycodes-quantum, keycodes-advanced, keycodes-shifted"
},
{
name: "**Advanced Keycodes**",
value: "command, dynamic-macros, grave-escape, leader, mod-tap, macros, mouse-keys, space-cadet, keycodes-shifted"
},
{
name: "**Software Features**",
value: "auto-shift, combos, debounce, key-lock, layers, one-shot-keys, pointing-device, swap-hands, tap-dance, tap-hold, terminal, unicode, wpm"
},
{
name: "**Hardware Features**",
value: "*Displays:* lcd, oled\n*Lighting:* backlight, led-matrix, rgblight, rgbmatrix\naudio, bluetooth, bootmagic, custom-matrix, dip-switch, encoders, haptic-feedback, ctpc, ps2-mouse, split-keyboard, stenography, velocikey"
},
{
name: "**Other Information**",
value: "mcus, contributing, translating, config-options, understanding-keyboards, understanding-matrix, understanding-qmk, conduct"
}];
// Construct plaintext help menu fallback
var array = [];
for (const [key, value] of helpmessage.entries()) {
array.push(`${helpmessage[key].name}\n${helpmessage[key].value}\n`);
}
plaintext = array.join("\n");
module.exports = {
// Object Literal alternative to switch/if-else mess
docsSwitch: (docs) => ({
"docs": "",
"newbs": "newbs",
"tutorial": "newbs",
"setup": "newbs_getting_started",
"syllabus": "syllabus",
"building": "newbs_building_firmware",
"flashing": "newbs_flashing",
"testing": "newbs_testing_debugging",
"debugging": "newbs_testing_debugging",
"faq": "faq_general",
"faqbuild": "faq_build",
"faqdebug": "faq_debug",
"faqkeymap": "faq_keymap",
"glossary": "reference_glossary",
"configurator": "newbs_building_firmware_configurator",
"api": "api_overview",
"cli": "cli",
"cliconfiguration": "cli_configuration",
"clicommands": "cli_commands",
"customizing": "custom_quantum_functions",
"zadig": "driver_installation_zadig",
"keymap": "keymap",
"vagrant": "getting_started_vagrant",
"flashing": "flashing",
"flashingbootloadhid": "flashing_bootloadhid",
"ideeclipse": "other_eclipse",
"idevscode": "other_vscode",
"handwire": "hand_wire",
"ispflashing": "isp_flashing_guide",
"keycodes": "keycodes",
"keycodesbasic": "keycodes_basic",
"keycodesquantum": "quantum_keycodes",
"keycodesshifted": "keycodes_us_ansi_shifted",
"keycodesadvanced": "feature_advanced_keycodes",
"command": "feature_command",
"dynamicmacros": "feature_dynamic_macros",
"graveescape": "feature_grave_esc",
"leader": "feature_leader",
"modtap": "mod_tap",
"macros": "feature_macros",
"mousekeys": "feature_mouse_keys",
"spacecadet": "feature_space_cadet",
"autoshift": "feature_auto_shift",
"combos": "feature_combo",
"debounce": "feature_debounce_type",
"keylock": "feature_key_lock",
"layers": "feature_layers",
"oneshotkeys": "one_shot_keys",
"pointingdevice": "feature_pointing_device",
"swaphands": "feature_swap_hands",
"tapdance": "feature_tap_dance",
"taphold": "tap_hold",
"terminal": "feature_terminal",
"unicode": "feature_unicode",
"userspace": "feature_userspace",
"wpm": "feature_wpm",
"lcd": "feature_hd44780",
"oled": "feature_oled_driver",
"backlight": "feature_backlight",
"ledmatrix": "feature_led_matrix",
"rgblight": "feature_rgblight",
"rgbmatrix": "feature_rgb_matrix",
"audio": "feature_audio",
"bluetooth": "feature_bluetooth",
"bootmagic": "feature_bootmagic",
"custommatrix": "custom_matrix",
"dipswitch": "feature_dip_switch",
"encoders": "feature_encoders",
"hapticfeedback": "feature_haptic_feedback",
"ctpc": "proton_c_conversion",
"ps2mouse": "feature_ps2_mouse",
"splitkeyboard": "feature_split_keyboard",
"stenography": "feature_stenography",
"velocikey": "feature_velocikey",
"mcus": "compatible_microcontrollers",
"contributing": "contributing",
"translating": "translating",
"configoptions": "config_options",
"understandingkeyboards": "how_keyboards_work",
"understandingmatrix": "how_a_matrix_works",
"understandingqmk": "understanding_qmk"
})[docs],
// Format embedded message
msg: {embed: {
color: "344703",
author: {
name: `Use any of the following commands starting with '!' for more information`
},
fields: helpmessage,
footer: {
text: `I respond to DMs, too!`
},
}},
plainhelp: plaintext,
prefix: '!',
baseurl: 'https://docs.qmk.fm/#/',
firmware: 'https://github.com/qmk/qmk_firmware/',
toolbox: 'https://github.com/qmk/qmk_toolbox/',
disclaimer: "If you don't see an embed, try `!plain`",
ohshitgit: 'https://ohshitgit.com/',
git: 'https://docs.qmk.fm/#/newbs_git_best_practices',
//xkcd: 'https://xkcd.com/1597/',
xkcd: 'https://imgs.xkcd.com/comics/git.png',
promicro: 'https://i.imgur.com/GsrDNHK.png',
protonc: 'https://i.imgur.com/nICqWLo.jpg',
elitec: 'https://i.imgur.com/WWnicKw.png',
msys: 'https://msys.qmk.fm/',
coc: 'https://qmk.fm/coc/',
kbdfans: 'Against our best advice, KBDfans have chosen a less than ideal bootloader for their newer board revisions. You may have luck using <https://tinyurl.com/KBDFansFlashNew> for reference, but if you are still stuck you will have to visit KBDfans discord for support: <https://discord.gg/kbdfans>',
vid: 'https://yanfali.github.io/qmk_usb_usage/',
vidq: 'https://www.the-sz.com/products/usbid/index.php',
cooldown: [],
authroles: ['Directors', 'Collaborators'],
// Parser
parse: function(string) {
return string.toLowerCase().substring(1).replace(/[^a-z\-]+/g, '').split(/ +/g);
},
// Bare link constructor (inhibits embeds)
bare: function(string) {
return `<${string}>`;
},
};