|
1 | 1 | export const helpCommand = { |
2 | | - description: "Shows available commands", |
3 | | - execute: () => { |
4 | | - const output = document.getElementById("terminal-output"); |
5 | | - if (!output) return; |
| 2 | + description: "Shows available commands", |
| 3 | + execute: () => { |
| 4 | + const output = document.getElementById("terminal-output"); |
| 5 | + if (!output) return; |
6 | 6 |
|
7 | | - const createHelpSection = (title, items) => { |
8 | | - const section = document.createElement("div"); |
9 | | - section.style.marginBottom = "10px"; |
10 | | - section.style.color = "#aaa"; |
| 7 | + const createHelpSection = (title, items) => { |
| 8 | + const section = document.createElement("div"); |
| 9 | + section.style.marginBottom = "10px"; |
| 10 | + section.style.color = "#aaa"; |
11 | 11 |
|
12 | | - const header = document.createElement("div"); |
13 | | - header.style.fontWeight = "bold"; |
14 | | - header.style.color = "#fff"; |
15 | | - header.style.marginBottom = "4px"; |
16 | | - header.innerText = title; |
17 | | - section.appendChild(header); |
| 12 | + const header = document.createElement("div"); |
| 13 | + header.style.fontWeight = "bold"; |
| 14 | + header.style.color = "#fff"; |
| 15 | + header.style.marginBottom = "4px"; |
| 16 | + header.innerText = title; |
| 17 | + section.appendChild(header); |
18 | 18 |
|
19 | | - items.forEach((item) => { |
20 | | - const div = document.createElement("div"); |
21 | | - div.innerHTML = `<span style="color: #4ade80">${item.cmd}</span> - ${item.desc}`; |
22 | | - section.appendChild(div); |
23 | | - }); |
| 19 | + items.forEach((item) => { |
| 20 | + const div = document.createElement("div"); |
| 21 | + div.innerHTML = `<span style="color: #4ade80">${item.cmd}</span> - ${item.desc}`; |
| 22 | + section.appendChild(div); |
| 23 | + }); |
24 | 24 |
|
25 | | - return section; |
26 | | - }; |
| 25 | + return section; |
| 26 | + }; |
27 | 27 |
|
28 | | - const helpContainer = document.createElement("div"); |
29 | | - helpContainer.className = "system-message"; |
30 | | - helpContainer.style.padding = "10px"; |
31 | | - helpContainer.style.borderTop = "1px dashed #333"; |
32 | | - helpContainer.style.borderBottom = "1px dashed #333"; |
33 | | - helpContainer.style.margin = "10px 0"; |
| 28 | + const helpContainer = document.createElement("div"); |
| 29 | + helpContainer.className = "system-message"; |
| 30 | + helpContainer.style.padding = "10px"; |
| 31 | + helpContainer.style.borderTop = "1px dashed #333"; |
| 32 | + helpContainer.style.borderBottom = "1px dashed #333"; |
| 33 | + helpContainer.style.margin = "10px 0"; |
34 | 34 |
|
35 | | - // system |
36 | | - const systemCmds = [ |
37 | | - { |
38 | | - cmd: "/whisper <user> <msg>", |
39 | | - desc: "Send a private message", |
40 | | - }, |
41 | | - { cmd: "/block <user>", desc: "Block messages from a user" }, |
42 | | - { cmd: "/unblock <user>", desc: "Unblock a user" }, |
43 | | - { |
44 | | - cmd: "/local <msg>", |
45 | | - desc: "Send message to direct peers only (Global by default)", |
46 | | - }, |
47 | | - { cmd: "/clear", desc: "Clear chat history" }, |
48 | | - { cmd: "/help", desc: "Show this help menu" }, |
49 | | - ]; |
50 | | - helpContainer.appendChild( |
51 | | - createHelpSection("System Commands", systemCmds) |
52 | | - ); |
| 35 | + // system |
| 36 | + const systemCmds = [ |
| 37 | + { |
| 38 | + cmd: "/whisper <user> <msg>", |
| 39 | + desc: "Send a private message", |
| 40 | + }, |
| 41 | + { cmd: "/block <user>", desc: "Block messages from a user" }, |
| 42 | + { cmd: "/unblock <user>", desc: "Unblock a user" }, |
| 43 | + { |
| 44 | + cmd: "/local <msg>", |
| 45 | + desc: "Send message to direct peers only (Global by default)", |
| 46 | + }, |
| 47 | + { cmd: "/clear", desc: "Clear chat history" }, |
| 48 | + { cmd: "/timestamp", desc: "Toggle timestamps" }, |
| 49 | + { cmd: "/sound", desc: "Toggle sound effects" }, |
| 50 | + { cmd: "/help", desc: "Show this help menu" }, |
| 51 | + ]; |
| 52 | + helpContainer.appendChild(createHelpSection("System Commands", systemCmds)); |
53 | 53 |
|
54 | | - // Formatting |
55 | | - const formatCmds = [ |
56 | | - { cmd: "**text**", desc: "Bold" }, |
57 | | - { cmd: "*text*", desc: "Italics" }, |
58 | | - { cmd: "__text__", desc: "Underline" }, |
59 | | - { cmd: "~~text~~", desc: "Strikethrough" }, |
60 | | - { cmd: "`text`", desc: "Code" }, |
61 | | - ]; |
62 | | - helpContainer.appendChild(createHelpSection("Formatting", formatCmds)); |
| 54 | + // Formatting |
| 55 | + const formatCmds = [ |
| 56 | + { cmd: "**text**", desc: "Bold" }, |
| 57 | + { cmd: "*text*", desc: "Italics" }, |
| 58 | + { cmd: "__text__", desc: "Underline" }, |
| 59 | + { cmd: "~~text~~", desc: "Strikethrough" }, |
| 60 | + { cmd: "`text`", desc: "Code" }, |
| 61 | + ]; |
| 62 | + helpContainer.appendChild(createHelpSection("Formatting", formatCmds)); |
63 | 63 |
|
64 | | - // Easter Eggs |
65 | | - const eggs = Object.entries(window.ChatCommands.replacements).map( |
66 | | - ([k, v]) => ({ |
67 | | - cmd: k, |
68 | | - desc: v, |
69 | | - }) |
70 | | - ); |
71 | | - helpContainer.appendChild(createHelpSection("Easter Eggs", eggs)); |
| 64 | + // Easter Eggs |
| 65 | + const eggs = Object.entries(window.ChatCommands.replacements).map( |
| 66 | + ([k, v]) => ({ |
| 67 | + cmd: k, |
| 68 | + desc: v, |
| 69 | + }) |
| 70 | + ); |
| 71 | + helpContainer.appendChild(createHelpSection("Easter Eggs", eggs)); |
72 | 72 |
|
73 | | - output.appendChild(helpContainer); |
74 | | - output.scrollTop = output.scrollHeight; |
75 | | - }, |
| 73 | + output.appendChild(helpContainer); |
| 74 | + output.scrollTop = output.scrollHeight; |
| 75 | + }, |
76 | 76 | }; |
0 commit comments