GithubHelp home page GithubHelp logo

usersatoshi / aoi.fb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from srwhale/aoi.fb

0.0 0.0 0.0 175 KB

aoi.fb - A Firebase Database wrapper using firebase with aoi.fb like API

License: Apache License 2.0

JavaScript 100.00%

aoi.fb's Introduction


aoi.fb

aoi.fb

A Firebase database of wrapper using aoi.fb as API


Support - Have questions or want to talk and contact the developers?

Log on to the support server now to get answers to your questions or to receive help with errors:

Table Of Contents

Documentation and tiny information
Methods Description Use
SET To set a value to a referenced key client.db.db.set('table', 'key', 'value')
GET To get the value of a table client.db.db.get('table', 'key').then(a => a.value)
ALL Returns all values of the reference client.db.db.all('table').then(a => a.map(b => b.key))
DELETE To delete all the values made in the reference, be it the whole table, ora directory further down client.db.db.delete('table', 'key')
Others Description Use
PING Requesting the database latency client.db.db.ping()
ARGSCOUNT Counting arguments to the value of the requested key client.db.db.argsCount('table', 'key')
ISSTRING Checking if the key value is a string client.db.db.isString('table', 'key')
ISNUMBER Checking if the key value is a number client.db.db.isNumber('table', 'key')

About

A Firebase database of wrapper using aoi.fb as API NPM Version NPM Downloads

Installation

Node.JS 16.0.0 or newer is required.

npm install aoi.fb@latest

Setup

This file is mandatory and necessary for aoi.fb to work in aoi.jsV5! -- Why? Please look at the end of the README Create a file in the root folder of your project (in the same folder where your index is) with the name: att.sh Then add the code below into the file:

rm ./node_modules/aoi.js/src/classes/*
cp ./node_modules/aoi.fb/src/adjust/* ./node_modules/aoi.js/src/classes/

Then, in your index file, configure aoi.fb:

const aoifb = require("aoi.fb")

const firebase = aoifb.Create({
  apiKey: "",
  authDomain: "",
  databaseURL: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: ""
})

const aoijs = require("aoi.js")

const bot = new aoijs.Bot({
  token: "TOKEN", // Discord Bot Token
  prefix: "PREFIX",// Discord Bot Prefix
  intents: ["GUILDS", "GUILD_MESSAGES"], //Discord Bot Intents
  database: {
    type: "aoi.fb",
    db: firebase
  } // Change database to aoi.fb
})

// LoadCommands
const loader = new aoijs.LoadCommands(bot);
loader.load(bot.cmd, './Commands/', false)

// Events
bot.onMessage();
bot.onMessageUpdate();
bot.onMessageDelete();
bot.onInteractionCreate();

// Command Example for Database Latency
bot.command({
  name: "ping",
  code: `Pong!
> Bot Latency: $pingms
> Database Latency: $djsEval[client.db.db.ping();yes]`
})

bot.readyCommand({
  channel: "",
  code: `$log[Ready on $userTag[$clientID]]`
})

Methods Examples

Database Illustration

(Table)
main--
    money--
          key: money
          value: 1000
    prefix--
          key: prefix
          value: fb.

SET

Example -

client.db.db.set('main', 'money', '1000') // Setting the value '1000' in the 'money' key that is in the 'main' table
// return: bolean (true)

GET

Example -

client.db.db.get('main', 'money').then(a => a.value) // Asking for the value of the 'money' key
// return: '1000' 

ALL

Example -

client.db.db.all('main').then(a => a.map(b => b.key)) // Requesting all keys and values within each of your 'main' tables
// return:  [ 'money', 'prefix' ] 
client.db.db.all('main').then(a => a.map(b => b.data.value)) // Requesting all values from your 'main' table
/* return: {
  money: '1000',
  prefix: 'fb.'
} */

DELETE

Example -

client.db.db.delete('table') // Deleting your entire (main) database table
// return: bolean (true)
client.db.db.delete('main', 'money') // Deleting the 'money' key and the value inside
// return: bolean (true)

Others

PING

Example -

client.db.db.ping() // Requesting the database latency
// return: RandomNumberFromLatencyms

ARGSCOUNT

Example -

client.db.db.argsCount('main', 'money')
// return: 4

ISSTRING

Example -

client.db.db.isString('main', 'money') // Checking if 'money' is a string
// return: bolean (false)
client.db.db.isString('main', 'prefix') // Checking if 'prefix' is a string
// return: bolean (true)

ISNUMBER

Example -

client.db.db.isString('main', 'prefix') // Checking if 'prefix' is a number
// return: bolean (false)
client.db.db.isNumber('main', 'money') // Checking if 'money' is a number
// return: bolean (true)

PackageJson

Your package.json should have a start script starting the node . that will start and run not only your index, but also the file nn att.sh

{
 "name": "YourBotName",
 "main": "index.js",
 "scripts": {
   "start": "node ."
 },
 "engines": {
   "node": "^16.6.0"
 },
 "devDependencies": {
   "node": "^16.6.0"
 },
 "dependencies": {
   "aoi.fb": "^5.2.8",
   "aoi.js": "^5.0.8"
 }
}

Terms

What is the att.sh file in Aoi.fb version 5 used for? The att.sh file is for when the project is started, and the database is created, the file is also started and executed, and inside the file, modifications are made to aoi.js so that Aoi.fb works in V5 of Aoi.js, and the adjustments are pulled from the "adjust" folder of the Aoi.fb source code. By creating this file and making use of aoi.fb you are aware that your version of aoi.jsV5 is being adapted or adjusted for the functionality of Aoi.fb .

AoiFB

aoi.fb, a Firebase database of wrapper using aoi.fb as API

Owned by GR GR#3012
Developer Luís Fernando Luís Fernando#1581

Open Source

aoi.fb is a package and db made for developers using aoi.js. Also made by you! If you want to contribute just do a pull-request

aoi.fb's People

Contributors

kruldev avatar srwhale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.