Skip to content

Commit

Permalink
edit readme
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenedtzjs committed Oct 16, 2024
1 parent aec123a commit 8e5b49c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 72 deletions.
9 changes: 0 additions & 9 deletions .github/CHANGES.md

This file was deleted.

14 changes: 0 additions & 14 deletions .github/SECURITY.md

This file was deleted.

59 changes: 10 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,72 +17,33 @@
</div>

# discord-afk-js

**[discord-afk-js](https://www.npmjs.com/package/discord-afk-js?activeTab=readme)** is a JavaScript library created to facilitate the management of AFK (Away From Keyboard) status within Discord bots. This library is designed to simplify the process of tracking and handling AFK users in a Discord server without the need for an external database.

# Requirements
- [NodeJS](https://nodejs.org) 16.9.0 or higher

- [NodeJS](https://nodejs.org) 18.x or higher

# Installation

To start using **discord-afk-js**, you can install it through npm, the Node.js package manager. Open your terminal and run the following command:

```bash
npm install discord-afk-js
```

# Usage
**discord-afk-js** offers a straightforward way to manage AFK users in your Discord bot. Below is an example of how to utilize the **AfkClient** class:

```javascript
const { AfkClient } = require('discord-afk-js');
const moment = require('moment');

// Create an instance of AfkClient
const afk = new AfkClient();

// Checking if a user is AFK without time
const reason = args.join(' ') || 'No Reason';
afk.addUser('user123', reason);

if (afk.findUser('user123')) {
console.log('User is marked as AFK'); // console: User is marked as AFK
console.log('AFK Message:', afk.afkMessage('user123')); // console: AFK Message: No Reason
}
// or
// Adding a user to AFK status with time
const reason = args.join(' ') || 'No Reason';
afk.addUser('user123', [Date.now(), reason]);

if (afk.findUser('user123')) {
console.log('User is marked as AFK'); // console: User is marked as AFK
const data = afk.findMessage('user123');

const [ time, reason ] = data;
const timeago = moment(time).fromNow();
[No Database Version](https://github.com/SITCommunity/discord-afk-js/tree/nodb-stable?tab=readme-ov-file)

console.log('AFK Message:', `${reason} ${timeago}`); // console: AFK Message: No Reason a few seconds ago
}

// Removing a user from AFK status
afk.removeUser('user123');
```
In the code snippet above, we start by importing the **AfkClient** class. After creating an instance of this class, we demonstrate how to add a user to the AFK list, check their AFK status, and remove them from AFK status.

# API
The **discord-afk-js** library provides a set of methods for working with AFK status using the **AfkClient** class.

# Changelog | Migrating to discord-afk-js
```diff
+ change afk to AfkClient for import
+ afk.set() -> afk.addUser()
+ afk.delete() -> afk.removeUser()
+ afk.get() -> afk.findUser()
+ afk.findMessage()
```
[Database Version](https://github.com/SITCommunity/discord-afk-js/tree/db-stable?tab=readme-ov-file)

# License
This project is open-source and is licensed under the Apache-2.0. You can find more details about the license in the [LICENSE.md](https://github.com/CyraTeam/discord-afk-js/blob/main/LICENSE) file included in the project.

This project is open-source and is licensed under MIT License. You can find more details about the license in the [LICENSE.md](https://github.com/CyraTeam/discord-afk-js/blob/main/LICENSE) file included in the project.

With this comprehensive readme, you have a clear and detailed guide on how to use the **discord-afk-js** library to manage AFK status in your Discord bot.

# Discord Servers
<a href="https://discord.gg/qpT2AeYZRN" target="_blank" rel="noopener noreferrer"><img alt="Discord" src="https://img.shields.io/discord/984857299858382908?label=CyraTeam&logo=discord"></a>

<a href="https://discord.gg/qpT2AeYZRN" target="_blank" rel="noopener noreferrer"><img alt="Discord" src="https://img.shields.io/discord/984857299858382908?label=CyraTeam&logo=discord"></a>

0 comments on commit 8e5b49c

Please sign in to comment.