Skip to content
/ cogs Public

A little cog system(Assumed to be used for discord.js command&event managers)

License

Notifications You must be signed in to change notification settings

Glow-bot/cogs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@glowbot/cogs

A wonderful package to help managing commands of discord.js

caution

module.exports.name,export name,module.exports.path,export path are overwritten by it's file name and full path

examples

Expamples are in the examples directory. You can simpliy import by

  • commonjs
const Cog = require("@glowbot/cogs")
//or
const {Cog} = require("@glowbot/cogs")
  • modulejs
import {Cog} from "@glowbot/cogs"
  • typescript
import {Cog} from "@glowbot/cogs"

and use by

const cog = new Cog("./cogs") // Path is defaultly "./"
console.log(cog) // Cog(0) [Map] {}


cog.loadAll()
console.log(cog) /* Cog(2) [Map] {
  '1' => {
    execute: [Function: execute],
    name: '1',
    path: 'HIDDEN/examples/cogs/1.js'
  },
  '2' => {
    execute: [Function: execute],
    name: '2',
    path: 'HIDDEN/examples/cogs/2.js'
  }
}*/
cog.unloadAll()
console.log(cog) // Cog(0) [Map] {}


cog.loadAll()
cog.unload("1")
console.log(cog) /* Cog(1) [Map] {
  '2' => {
    execute: [Function: execute],
    name: '2',
    path: 'HIDDEN/examples/cogs/2.js'
  }
}*/


cog.load("1.js")
console.log(cog) /* Cog(2) [Map] {
  '1' => {
    execute: [Function: execute],
    name: '1',
    path: 'HIDDEN/examples/cogs/1.js'
  },
  '2' => {
    execute: [Function: execute],
    name: '2',
    path: 'HIDDEN/examples/cogs/2.js'
  }
}*/

ads

My discord bot Invite Link

thanks

Cog system was inspired from discord.py

About

A little cog system(Assumed to be used for discord.js command&event managers)

Resources

License

Stars

Watchers

Forks

Packages

No packages published