Update index.html
Browse files- index.html +116 -34
index.html
CHANGED
|
@@ -7,12 +7,15 @@
|
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
<style>
|
| 9 |
:root {
|
| 10 |
-
--primary: #
|
| 11 |
-
--secondary: #
|
| 12 |
-
--dark: #
|
| 13 |
-
--light: #
|
| 14 |
-
--
|
|
|
|
| 15 |
--code-bg: #2d2d2d;
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
* {
|
|
@@ -23,8 +26,8 @@
|
|
| 23 |
}
|
| 24 |
|
| 25 |
body {
|
| 26 |
-
background-color: var(--
|
| 27 |
-
color: var(--
|
| 28 |
line-height: 1.6;
|
| 29 |
}
|
| 30 |
|
|
@@ -39,7 +42,7 @@
|
|
| 39 |
color: white;
|
| 40 |
padding: 2rem 0;
|
| 41 |
border-radius: 0 0 20px 20px;
|
| 42 |
-
box-shadow: 0 10px 20px rgba(0,0,0,0.
|
| 43 |
margin-bottom: 2rem;
|
| 44 |
text-align: center;
|
| 45 |
}
|
|
@@ -59,26 +62,38 @@
|
|
| 59 |
|
| 60 |
.badge {
|
| 61 |
display: inline-block;
|
| 62 |
-
background-color: var(--
|
| 63 |
-
color:
|
| 64 |
padding: 0.3rem 0.8rem;
|
| 65 |
border-radius: 20px;
|
| 66 |
font-size: 0.8rem;
|
| 67 |
margin-top: 1rem;
|
| 68 |
font-weight: bold;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
}
|
| 70 |
|
| 71 |
.card {
|
| 72 |
-
background:
|
| 73 |
border-radius: 10px;
|
| 74 |
padding: 2rem;
|
| 75 |
margin-bottom: 2rem;
|
| 76 |
-
box-shadow: 0 5px 15px rgba(0,0,0,0.
|
| 77 |
border-left: 4px solid var(--primary);
|
| 78 |
}
|
| 79 |
|
| 80 |
.card h2 {
|
| 81 |
-
color: var(--
|
| 82 |
margin-bottom: 1rem;
|
| 83 |
display: flex;
|
| 84 |
align-items: center;
|
|
@@ -86,10 +101,11 @@
|
|
| 86 |
|
| 87 |
.card h2 i {
|
| 88 |
margin-right: 10px;
|
|
|
|
| 89 |
}
|
| 90 |
|
| 91 |
.section-title {
|
| 92 |
-
color: var(--
|
| 93 |
margin: 2rem 0 1rem;
|
| 94 |
font-size: 1.8rem;
|
| 95 |
position: relative;
|
|
@@ -125,6 +141,7 @@
|
|
| 125 |
overflow-x: auto;
|
| 126 |
margin: 1rem 0;
|
| 127 |
box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
|
|
|
|
| 128 |
}
|
| 129 |
|
| 130 |
pre code {
|
|
@@ -136,26 +153,32 @@
|
|
| 136 |
width: 100%;
|
| 137 |
border-collapse: collapse;
|
| 138 |
margin: 1rem 0;
|
|
|
|
| 139 |
}
|
| 140 |
|
| 141 |
th, td {
|
| 142 |
padding: 12px 15px;
|
| 143 |
text-align: left;
|
| 144 |
-
border-bottom: 1px solid
|
| 145 |
}
|
| 146 |
|
| 147 |
th {
|
| 148 |
background-color: var(--primary);
|
| 149 |
-
color:
|
|
|
|
| 150 |
}
|
| 151 |
|
| 152 |
tr:nth-child(even) {
|
| 153 |
-
background-color:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
}
|
| 155 |
|
| 156 |
.note {
|
| 157 |
-
background-color:
|
| 158 |
-
border-left: 4px solid
|
| 159 |
padding: 1rem;
|
| 160 |
margin: 1rem 0;
|
| 161 |
border-radius: 0 4px 4px 0;
|
|
@@ -164,21 +187,31 @@
|
|
| 164 |
.note-title {
|
| 165 |
font-weight: bold;
|
| 166 |
margin-bottom: 0.5rem;
|
| 167 |
-
color:
|
| 168 |
display: flex;
|
| 169 |
align-items: center;
|
| 170 |
}
|
| 171 |
|
| 172 |
.note-title i {
|
| 173 |
margin-right: 8px;
|
|
|
|
| 174 |
}
|
| 175 |
|
| 176 |
footer {
|
| 177 |
text-align: center;
|
| 178 |
margin-top: 3rem;
|
| 179 |
padding: 2rem 0;
|
| 180 |
-
color: #
|
| 181 |
-
border-top: 1px solid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
}
|
| 183 |
|
| 184 |
@media (max-width: 768px) {
|
|
@@ -200,7 +233,7 @@
|
|
| 200 |
<body>
|
| 201 |
<header>
|
| 202 |
<div class="container">
|
| 203 |
-
<h1>ReikerNx Bot SDK</h1>
|
| 204 |
<p>A lightweight Node.js wrapper to manage your bot's direct messages and group messages easily.</p>
|
| 205 |
<span class="badge">Node.js</span>
|
| 206 |
</div>
|
|
@@ -210,8 +243,10 @@
|
|
| 210 |
<section id="installation">
|
| 211 |
<h2 class="section-title">Installation</h2>
|
| 212 |
<div class="card">
|
| 213 |
-
<p>
|
| 214 |
-
<pre><code>
|
|
|
|
|
|
|
| 215 |
</div>
|
| 216 |
</section>
|
| 217 |
|
|
@@ -219,7 +254,7 @@
|
|
| 219 |
<h2 class="section-title">Setup</h2>
|
| 220 |
<div class="card">
|
| 221 |
<p>Before using any function, you must configure your bot:</p>
|
| 222 |
-
<pre><code>
|
| 223 |
botUsername: 'your_bot_username',
|
| 224 |
password: 'your_bot_password'
|
| 225 |
});</code></pre>
|
|
@@ -250,7 +285,7 @@
|
|
| 250 |
<tr>
|
| 251 |
<td><code>text</code></td>
|
| 252 |
<td>string</td>
|
| 253 |
-
<td>Message text</td>
|
| 254 |
</tr>
|
| 255 |
<tr>
|
| 256 |
<td><code>isMedia</code></td>
|
|
@@ -260,13 +295,13 @@
|
|
| 260 |
<tr>
|
| 261 |
<td><code>replyto</code></td>
|
| 262 |
<td>string (optional)</td>
|
| 263 |
-
<td>Message ID you are replying to</td>
|
| 264 |
</tr>
|
| 265 |
</tbody>
|
| 266 |
</table>
|
| 267 |
|
| 268 |
<p>Example:</p>
|
| 269 |
-
<pre><code>await
|
| 270 |
to: 'username123',
|
| 271 |
text: 'Hello!',
|
| 272 |
isMedia: false
|
|
@@ -305,7 +340,7 @@
|
|
| 305 |
</table>
|
| 306 |
|
| 307 |
<p>Example:</p>
|
| 308 |
-
<pre><code>await
|
| 309 |
to: 'groupchatid',
|
| 310 |
text: 'Hey everyone!'
|
| 311 |
});</code></pre>
|
|
@@ -381,15 +416,61 @@
|
|
| 381 |
<tr>
|
| 382 |
<td><code>recipient</code></td>
|
| 383 |
<td>string</td>
|
| 384 |
-
<td>Same as to</td>
|
| 385 |
</tr>
|
| 386 |
</tbody>
|
| 387 |
</table>
|
| 388 |
|
| 389 |
-
<
|
| 390 |
-
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
});</code></pre>
|
|
|
|
| 393 |
</div>
|
| 394 |
</section>
|
| 395 |
|
|
@@ -402,6 +483,7 @@
|
|
| 402 |
<li>Messages are polled every second.</li>
|
| 403 |
<li>Duplicate messages are prevented using a local timestamps.json file.</li>
|
| 404 |
<li>All functions require the bot to be configured first via setup().</li>
|
|
|
|
| 405 |
<li>Errors will be thrown if setup is missing or incomplete.</li>
|
| 406 |
</ul>
|
| 407 |
</div>
|
|
|
|
| 7 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 8 |
<style>
|
| 9 |
:root {
|
| 10 |
+
--primary: #ff6b35;
|
| 11 |
+
--secondary: #ff9e1b;
|
| 12 |
+
--dark: #121212;
|
| 13 |
+
--light: #1e1e1e;
|
| 14 |
+
--text: #e0e0e0;
|
| 15 |
+
--accent: #ff9e1b;
|
| 16 |
--code-bg: #2d2d2d;
|
| 17 |
+
--card-bg: #252525;
|
| 18 |
+
--border: #333;
|
| 19 |
}
|
| 20 |
|
| 21 |
* {
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
body {
|
| 29 |
+
background-color: var(--dark);
|
| 30 |
+
color: var(--text);
|
| 31 |
line-height: 1.6;
|
| 32 |
}
|
| 33 |
|
|
|
|
| 42 |
color: white;
|
| 43 |
padding: 2rem 0;
|
| 44 |
border-radius: 0 0 20px 20px;
|
| 45 |
+
box-shadow: 0 10px 20px rgba(0,0,0,0.3);
|
| 46 |
margin-bottom: 2rem;
|
| 47 |
text-align: center;
|
| 48 |
}
|
|
|
|
| 62 |
|
| 63 |
.badge {
|
| 64 |
display: inline-block;
|
| 65 |
+
background-color: var(--dark);
|
| 66 |
+
color: var(--accent);
|
| 67 |
padding: 0.3rem 0.8rem;
|
| 68 |
border-radius: 20px;
|
| 69 |
font-size: 0.8rem;
|
| 70 |
margin-top: 1rem;
|
| 71 |
font-weight: bold;
|
| 72 |
+
border: 1px solid var(--accent);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.version {
|
| 76 |
+
display: inline-block;
|
| 77 |
+
background-color: var(--accent);
|
| 78 |
+
color: var(--dark);
|
| 79 |
+
padding: 0.3rem 0.8rem;
|
| 80 |
+
border-radius: 20px;
|
| 81 |
+
font-size: 0.8rem;
|
| 82 |
+
margin-left: 0.5rem;
|
| 83 |
+
font-weight: bold;
|
| 84 |
}
|
| 85 |
|
| 86 |
.card {
|
| 87 |
+
background: var(--card-bg);
|
| 88 |
border-radius: 10px;
|
| 89 |
padding: 2rem;
|
| 90 |
margin-bottom: 2rem;
|
| 91 |
+
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
| 92 |
border-left: 4px solid var(--primary);
|
| 93 |
}
|
| 94 |
|
| 95 |
.card h2 {
|
| 96 |
+
color: var(--accent);
|
| 97 |
margin-bottom: 1rem;
|
| 98 |
display: flex;
|
| 99 |
align-items: center;
|
|
|
|
| 101 |
|
| 102 |
.card h2 i {
|
| 103 |
margin-right: 10px;
|
| 104 |
+
color: var(--primary);
|
| 105 |
}
|
| 106 |
|
| 107 |
.section-title {
|
| 108 |
+
color: var(--accent);
|
| 109 |
margin: 2rem 0 1rem;
|
| 110 |
font-size: 1.8rem;
|
| 111 |
position: relative;
|
|
|
|
| 141 |
overflow-x: auto;
|
| 142 |
margin: 1rem 0;
|
| 143 |
box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
|
| 144 |
+
border: 1px solid var(--border);
|
| 145 |
}
|
| 146 |
|
| 147 |
pre code {
|
|
|
|
| 153 |
width: 100%;
|
| 154 |
border-collapse: collapse;
|
| 155 |
margin: 1rem 0;
|
| 156 |
+
border: 1px solid var(--border);
|
| 157 |
}
|
| 158 |
|
| 159 |
th, td {
|
| 160 |
padding: 12px 15px;
|
| 161 |
text-align: left;
|
| 162 |
+
border-bottom: 1px solid var(--border);
|
| 163 |
}
|
| 164 |
|
| 165 |
th {
|
| 166 |
background-color: var(--primary);
|
| 167 |
+
color: var(--dark);
|
| 168 |
+
font-weight: bold;
|
| 169 |
}
|
| 170 |
|
| 171 |
tr:nth-child(even) {
|
| 172 |
+
background-color: rgba(255, 107, 53, 0.05);
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
tr:hover {
|
| 176 |
+
background-color: rgba(255, 107, 53, 0.1);
|
| 177 |
}
|
| 178 |
|
| 179 |
.note {
|
| 180 |
+
background-color: rgba(255, 107, 53, 0.1);
|
| 181 |
+
border-left: 4px solid var(--primary);
|
| 182 |
padding: 1rem;
|
| 183 |
margin: 1rem 0;
|
| 184 |
border-radius: 0 4px 4px 0;
|
|
|
|
| 187 |
.note-title {
|
| 188 |
font-weight: bold;
|
| 189 |
margin-bottom: 0.5rem;
|
| 190 |
+
color: var(--accent);
|
| 191 |
display: flex;
|
| 192 |
align-items: center;
|
| 193 |
}
|
| 194 |
|
| 195 |
.note-title i {
|
| 196 |
margin-right: 8px;
|
| 197 |
+
color: var(--primary);
|
| 198 |
}
|
| 199 |
|
| 200 |
footer {
|
| 201 |
text-align: center;
|
| 202 |
margin-top: 3rem;
|
| 203 |
padding: 2rem 0;
|
| 204 |
+
color: #888;
|
| 205 |
+
border-top: 1px solid var(--border);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
.example-script {
|
| 209 |
+
margin-top: 2rem;
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
.example-script h3 {
|
| 213 |
+
color: var(--accent);
|
| 214 |
+
margin-bottom: 0.5rem;
|
| 215 |
}
|
| 216 |
|
| 217 |
@media (max-width: 768px) {
|
|
|
|
| 233 |
<body>
|
| 234 |
<header>
|
| 235 |
<div class="container">
|
| 236 |
+
<h1>ReikerNx Bot SDK <span class="version">v1.0.0</span></h1>
|
| 237 |
<p>A lightweight Node.js wrapper to manage your bot's direct messages and group messages easily.</p>
|
| 238 |
<span class="badge">Node.js</span>
|
| 239 |
</div>
|
|
|
|
| 243 |
<section id="installation">
|
| 244 |
<h2 class="section-title">Installation</h2>
|
| 245 |
<div class="card">
|
| 246 |
+
<p>Install the package using npm:</p>
|
| 247 |
+
<pre><code>npm install reikernx</code></pre>
|
| 248 |
+
<p>Then require it in your project:</p>
|
| 249 |
+
<pre><code>const nexus = require('reikernx');</code></pre>
|
| 250 |
</div>
|
| 251 |
</section>
|
| 252 |
|
|
|
|
| 254 |
<h2 class="section-title">Setup</h2>
|
| 255 |
<div class="card">
|
| 256 |
<p>Before using any function, you must configure your bot:</p>
|
| 257 |
+
<pre><code>nexus.setup({
|
| 258 |
botUsername: 'your_bot_username',
|
| 259 |
password: 'your_bot_password'
|
| 260 |
});</code></pre>
|
|
|
|
| 285 |
<tr>
|
| 286 |
<td><code>text</code></td>
|
| 287 |
<td>string</td>
|
| 288 |
+
<td>Message text or media URL</td>
|
| 289 |
</tr>
|
| 290 |
<tr>
|
| 291 |
<td><code>isMedia</code></td>
|
|
|
|
| 295 |
<tr>
|
| 296 |
<td><code>replyto</code></td>
|
| 297 |
<td>string (optional)</td>
|
| 298 |
+
<td>Message ID you are replying to (currently not supported for media)</td>
|
| 299 |
</tr>
|
| 300 |
</tbody>
|
| 301 |
</table>
|
| 302 |
|
| 303 |
<p>Example:</p>
|
| 304 |
+
<pre><code>await nexus.sendDM({
|
| 305 |
to: 'username123',
|
| 306 |
text: 'Hello!',
|
| 307 |
isMedia: false
|
|
|
|
| 340 |
</table>
|
| 341 |
|
| 342 |
<p>Example:</p>
|
| 343 |
+
<pre><code>await nexus.sendGroup({
|
| 344 |
to: 'groupchatid',
|
| 345 |
text: 'Hey everyone!'
|
| 346 |
});</code></pre>
|
|
|
|
| 416 |
<tr>
|
| 417 |
<td><code>recipient</code></td>
|
| 418 |
<td>string</td>
|
| 419 |
+
<td>Same as to (use this for replies)</td>
|
| 420 |
</tr>
|
| 421 |
</tbody>
|
| 422 |
</table>
|
| 423 |
|
| 424 |
+
<div class="example-script">
|
| 425 |
+
<h3>Example Script Usage:</h3>
|
| 426 |
+
<pre><code>nexus.setup({
|
| 427 |
+
botUsername: 'yourusername',
|
| 428 |
+
password: 'yourpassword'
|
| 429 |
+
});
|
| 430 |
+
|
| 431 |
+
nexus.listenMessages(async (msg) => {
|
| 432 |
+
const text = msg.text.trim().toLowerCase();
|
| 433 |
+
|
| 434 |
+
// !ping in group
|
| 435 |
+
if (msg.type === 'group' && text === '!ping') {
|
| 436 |
+
await nexus.sendGroup({
|
| 437 |
+
to: msg.recipient, // group id
|
| 438 |
+
text: 'Hello'
|
| 439 |
+
});
|
| 440 |
+
console.log(`Replied Hello to group ${msg.recipient}`);
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// !pic in DM
|
| 444 |
+
if (msg.type === 'dm' && text === '!pic') {
|
| 445 |
+
await nexus.sendDM({
|
| 446 |
+
to: msg.recipient, // username
|
| 447 |
+
text: 'https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png',
|
| 448 |
+
isMedia: true
|
| 449 |
+
});
|
| 450 |
+
console.log(`Sent picture to DM ${msg.recipient}`);
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
// !reply in both DM or group
|
| 454 |
+
if (text === '!reply') {
|
| 455 |
+
if (msg.type === 'group') {
|
| 456 |
+
await nexus.sendGroup({
|
| 457 |
+
to: msg.recipient,
|
| 458 |
+
text: 'This is a reply to your message!',
|
| 459 |
+
replyto: msg.id
|
| 460 |
+
});
|
| 461 |
+
console.log(`Replied to group message ${msg.id}`);
|
| 462 |
+
}
|
| 463 |
+
if (msg.type === 'dm') {
|
| 464 |
+
await nexus.sendDM({
|
| 465 |
+
to: msg.recipient,
|
| 466 |
+
text: 'This is a reply to your message!',
|
| 467 |
+
replyto: msg.id
|
| 468 |
+
});
|
| 469 |
+
console.log(`Replied to DM message ${msg.id}`);
|
| 470 |
+
}
|
| 471 |
+
}
|
| 472 |
});</code></pre>
|
| 473 |
+
</div>
|
| 474 |
</div>
|
| 475 |
</section>
|
| 476 |
|
|
|
|
| 483 |
<li>Messages are polled every second.</li>
|
| 484 |
<li>Duplicate messages are prevented using a local timestamps.json file.</li>
|
| 485 |
<li>All functions require the bot to be configured first via setup().</li>
|
| 486 |
+
<li>Media messages cannot be replied to at this time.</li>
|
| 487 |
<li>Errors will be thrown if setup is missing or incomplete.</li>
|
| 488 |
</ul>
|
| 489 |
</div>
|