Docs / index.html
NexusV1's picture
Update index.html
088abc1 verified
Raw
History Blame Contribute Delete
16.2 kB
<!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 &copy; 2025</p>
</div>
</footer>
</body>
</html>