File size: 16,180 Bytes
d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 ee48526 d5ce0b8 088abc1 d5ce0b8 | 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 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ReikerNx Bot SDK Documentation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary: #ff6b35;
--secondary: #ff9e1b;
--dark: #121212;
--light: #1e1e1e;
--text: #e0e0e0;
--accent: #ff9e1b;
--code-bg: #2d2d2d;
--card-bg: #252525;
--border: #333;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: var(--dark);
color: var(--text);
line-height: 1.6;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
header {
background: linear-gradient(135deg, var(--primary), var(--secondary));
color: white;
padding: 2rem 0;
border-radius: 0 0 20px 20px;
box-shadow: 0 10px 20px rgba(0,0,0,0.3);
margin-bottom: 2rem;
text-align: center;
}
header h1 {
font-size: 3rem;
margin-bottom: 0.5rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
header p {
font-size: 1.2rem;
max-width: 800px;
margin: 0 auto;
opacity: 0.9;
}
.badge {
display: inline-block;
background-color: var(--dark);
color: var(--accent);
padding: 0.3rem 0.8rem;
border-radius: 20px;
font-size: 0.8rem;
margin-top: 1rem;
font-weight: bold;
border: 1px solid var(--accent);
}
.version {
display: inline-block;
background-color: var(--accent);
color: var(--dark);
padding: 0.3rem 0.8rem;
border-radius: 20px;
font-size: 0.8rem;
margin-left: 0.5rem;
font-weight: bold;
}
.card {
background: var(--card-bg);
border-radius: 10px;
padding: 2rem;
margin-bottom: 2rem;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
border-left: 4px solid var(--primary);
}
.card h2 {
color: var(--accent);
margin-bottom: 1rem;
display: flex;
align-items: center;
}
.card h2 i {
margin-right: 10px;
color: var(--primary);
}
.section-title {
color: var(--accent);
margin: 2rem 0 1rem;
font-size: 1.8rem;
position: relative;
padding-left: 20px;
}
.section-title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 80%;
width: 5px;
background: var(--primary);
border-radius: 5px;
}
code {
background-color: var(--code-bg);
color: #f8f8f2;
padding: 0.2rem 0.4rem;
border-radius: 4px;
font-family: 'Courier New', Courier, monospace;
font-size: 0.9rem;
}
pre {
background-color: var(--code-bg);
color: #f8f8f2;
padding: 1rem;
border-radius: 8px;
overflow-x: auto;
margin: 1rem 0;
box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
border: 1px solid var(--border);
}
pre code {
background: none;
padding: 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 1rem 0;
border: 1px solid var(--border);
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid var(--border);
}
th {
background-color: var(--primary);
color: var(--dark);
font-weight: bold;
}
tr:nth-child(even) {
background-color: rgba(255, 107, 53, 0.05);
}
tr:hover {
background-color: rgba(255, 107, 53, 0.1);
}
.note {
background-color: rgba(255, 107, 53, 0.1);
border-left: 4px solid var(--primary);
padding: 1rem;
margin: 1rem 0;
border-radius: 0 4px 4px 0;
}
.note-title {
font-weight: bold;
margin-bottom: 0.5rem;
color: var(--accent);
display: flex;
align-items: center;
}
.note-title i {
margin-right: 8px;
color: var(--primary);
}
footer {
text-align: center;
margin-top: 3rem;
padding: 2rem 0;
color: #888;
border-top: 1px solid var(--border);
}
.example-script {
margin-top: 2rem;
}
.example-script h3 {
color: var(--accent);
margin-bottom: 0.5rem;
}
@media (max-width: 768px) {
header h1 {
font-size: 2rem;
}
.card {
padding: 1.5rem;
}
th, td {
padding: 8px 10px;
font-size: 0.9rem;
}
}
</style>
</head>
<body>
<header>
<div class="container">
<h1>ReikerNx Bot SDK <span class="version">v1.0.0</span></h1>
<p>A lightweight Node.js wrapper to manage your bot's direct messages and group messages easily.</p>
<span class="badge">Node.js</span>
</div>
</header>
<div class="container">
<section id="installation">
<h2 class="section-title">Installation</h2>
<div class="card">
<p>Install the package using npm:</p>
<pre><code>npm install reikernx</code></pre>
<p>Then require it in your project:</p>
<pre><code>const nexus = require('reikernx');</code></pre>
</div>
</section>
<section id="setup">
<h2 class="section-title">Setup</h2>
<div class="card">
<p>Before using any function, you must configure your bot:</p>
<pre><code>nexus.setup({
botUsername: 'your_bot_username',
password: 'your_bot_password'
});</code></pre>
</div>
</section>
<section id="functions">
<h2 class="section-title">Functions</h2>
<div class="card">
<h2><i class="fas fa-paper-plane"></i> sendDM({ to, text, isMedia = false, replyto = null })</h2>
<p>Send a direct message to a user.</p>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>to</code></td>
<td>string</td>
<td>Username of the recipient</td>
</tr>
<tr>
<td><code>text</code></td>
<td>string</td>
<td>Message text or media URL</td>
</tr>
<tr>
<td><code>isMedia</code></td>
<td>boolean (optional)</td>
<td>Set to true if it's a media message</td>
</tr>
<tr>
<td><code>replyto</code></td>
<td>string (optional)</td>
<td>Message ID you are replying to (currently not supported for media)</td>
</tr>
</tbody>
</table>
<p>Example:</p>
<pre><code>await nexus.sendDM({
to: 'username123',
text: 'Hello!',
isMedia: false
});</code></pre>
</div>
<div class="card">
<h2><i class="fas fa-users"></i> sendGroup({ to, text, replyto = null })</h2>
<p>Send a message to a group chat.</p>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>to</code></td>
<td>string</td>
<td>Group ID</td>
</tr>
<tr>
<td><code>text</code></td>
<td>string</td>
<td>Message text</td>
</tr>
<tr>
<td><code>replyto</code></td>
<td>string (optional)</td>
<td>Message ID you are replying to</td>
</tr>
</tbody>
</table>
<p>Example:</p>
<pre><code>await nexus.sendGroup({
to: 'groupchatid',
text: 'Hey everyone!'
});</code></pre>
</div>
<div class="card">
<h2><i class="fas fa-comment-dots"></i> listenMessages(callback)</h2>
<p>Start listening for new incoming messages (both DMs and Group Messages).</p>
<table>
<thead>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>callback</code></td>
<td>function</td>
<td>A function that will be triggered for each new message</td>
</tr>
</tbody>
</table>
<p>Each message passed to the callback will have the following structure:</p>
<table>
<thead>
<tr>
<th>Property</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>type</code></td>
<td>string</td>
<td>'dm' or 'group'</td>
</tr>
<tr>
<td><code>id</code></td>
<td>string</td>
<td>Unique message ID</td>
</tr>
<tr>
<td><code>from</code></td>
<td>string</td>
<td>Sender username</td>
</tr>
<tr>
<td><code>to</code></td>
<td>string</td>
<td>Recipient (username for DM / group ID for group)</td>
</tr>
<tr>
<td><code>text</code></td>
<td>string</td>
<td>Message content</td>
</tr>
<tr>
<td><code>media</code></td>
<td>boolean</td>
<td>Whether the message contains media</td>
</tr>
<tr>
<td><code>replyTo</code></td>
<td>string or null</td>
<td>ID of the message being replied to</td>
</tr>
<tr>
<td><code>recipient</code></td>
<td>string</td>
<td>Same as to (use this for replies)</td>
</tr>
</tbody>
</table>
<div class="example-script">
<h3>Example Script Usage:</h3>
<pre><code>nexus.setup({
botUsername: 'yourusername',
password: 'yourpassword'
});
nexus.listenMessages(async (msg) => {
const text = msg.text.trim().toLowerCase();
// !ping in group
if (msg.type === 'group' && text === '!ping') {
await nexus.sendGroup({
to: msg.recipient, // group id
text: 'Hello'
});
console.log(`Replied Hello to group ${msg.recipient}`);
}
// !pic in DM
if (msg.type === 'dm' && text === '!pic') {
await nexus.sendDM({
to: msg.recipient, // username
text: 'https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png',
isMedia: true
});
console.log(`Sent picture to DM ${msg.recipient}`);
}
// !reply in both DM or group
if (text === '!reply') {
if (msg.type === 'group') {
await nexus.sendGroup({
to: msg.recipient,
text: 'This is a reply to your message!',
replyto: msg.id
});
console.log(`Replied to group message ${msg.id}`);
}
if (msg.type === 'dm') {
await nexus.sendDM({
to: msg.recipient,
text: 'This is a reply to your message!',
replyto: msg.id
});
console.log(`Replied to DM message ${msg.id}`);
}
}
});</code></pre>
</div>
</div>
</section>
<section id="notes">
<h2 class="section-title">Notes</h2>
<div class="card">
<div class="note">
<div class="note-title"><i class="fas fa-info-circle"></i> Important Information</div>
<ul>
<li>Messages are polled every second.</li>
<li>Duplicate messages are prevented using a local timestamps.json file.</li>
<li>All functions require the bot to be configured first via setup().</li>
<li>Media messages cannot be replied to at this time.</li>
<li>Errors will be thrown if setup is missing or incomplete.</li>
</ul>
</div>
<p>This SDK provides simple bot management.<br>
No external API details or backend configurations are required from your side.</p>
</div>
</section>
</div>
<footer>
<div class="container">
<p>ReikerNx Bot SDK Documentation © 2025</p>
</div>
</footer>
</body>
</html> |