https://github.com/agenthackeryt/discord.prefixdb
https://github.com/agenthackeryt/discord.prefixdb
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/agenthackeryt/discord.prefixdb
- Owner: AgentHackerYT
- Created: 2021-10-07T08:56:13.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-07T08:57:29.000Z (over 4 years ago)
- Last Synced: 2025-03-09T08:51:48.087Z (over 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Discord.PrefixDB
- Made Using QuickDB
- Simple To Use
- Better Then Before
# How To Use?
```js
const { PrefixDB } = require("discord.prefixdb")
const Discord = require("discord.js")
const client = new Discord.Client({ intents: [Discord.Intents.FLAGS.GUILDS ,Discord.Intents.FLAGS.GUILD_MESSAGES, Discord.Intents.FLAGS.DIRECT_MESSAGES, Discord.Intents.FLAGS.GUILD_MEMBERS,] })
const config =
{
defaultprefix:"!",
token:"TOKEN_HERE"
}
client.on('ready', () =>{
console.log('Ready!!')
})
client.on('messageCreate' async(message) =>{
const db = new PrefixDB({message: message})
let prefix = db.get(config.defaultprefix)
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(' ');
const command = args.shift().toLowerCase();
if(command === "setprefix"){
db.set(args[0])
message.channel.send({content: 'Successfully changed the prefix'})
}
if(command === "deleteprefix"){
db.delete()
}
if(command === "allprefix"){
console.log(db.all())
}
})
client.login(config.token)
```
# All Functions
- Creating A DB
```js
const { PrefixDB } = require('discord.prefixdb')
const db = new PrefixDB({message: MessageProperty(Object)})
```
- Get The Prefix
```js
/**
* @param {defaultprefx} string;
* */
db.get("!" /*<- DefaultPrefix*/)
```
- All Prefix Data
```js
console.log(db.all())
```
- Delete Prefix for a Server
```js
/**
* @param {prefix} string;
* */
db.set(prefix)
```